def add_component()

in solutions_builder/cli/component.py [0:0]


def add_component(component_name,
                  template_path: Annotated[str,
                                           typer.Option("--template", "-t")] = None,
                  solution_path: Annotated[Optional[str],
                                           typer.Argument()] = ".",
                  destination_path: Annotated[str,
                                              typer.Option("--dest", "-d")] = "components",
                  yes: Optional[bool] = False,
                  answers=None):
  # validate_solution_folder(solution_path)

  # Check if template_path is empty.
  if not template_path:
    print("Please set --template or -t to a local folder path, "
          "remote git repo, or one of modules below:")
    list_component_templates()
    return

  confirm(
      f"This will add component '{component_name}' to "
      f"'{destination_path}' folder. Continue?",
      skip=yes)

  answers_dict = get_answers_dict(answers)
  answers_dict["destination_path"] = destination_path
  process_component("add",
                    component_name, template_path,
                    solution_path, destination_path, data=answers_dict)
  print_success(
      f"Complete. Component {component_name} added to solution at {solution_path}\n"
  )