def update_component()

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


def update_component(component_name,
                     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)
  confirm(
      f"This will update '{component_name}' in "
      f"'{solution_path}/components'. Continue?",
      skip=yes)

  sb_yaml = read_yaml(f"{solution_path}/sb.yaml")
  components = sb_yaml.get("components", {})
  component_dict = components.get(component_name, {})
  template_path = component_dict.get("template_path")

  answers_dict = get_answers_dict(answers)
  process_component("update",
                    component_name,
                    template_path,
                    solution_path,
                    destination_path,
                    data=answers_dict,
                    use_existing_answers=yes)
  print_success(
      f"Complete. Component {component_name} updated.\n"
  )