refactor: app move review pass

This commit is contained in:
2025-09-01 07:36:13 +02:00
parent 61849a358c
commit 824f314472
5 changed files with 145 additions and 93 deletions

View File

@ -159,16 +159,26 @@ func MoveOverview(
domain = config.NO_DOMAIN_DEFAULT
}
rows := [][]string{
{"DOMAIN", domain},
{"RECIPE", app.Recipe.Name},
{"OLD SERVER", server},
{"New SERVER", newServer},
{"SECRETS", strings.Join(secrets, "\n")},
{"VOLUMES", strings.Join(volumes, "\n")},
secretsOverview := strings.Join(secrets, "\n")
if len(secrets) == 0 {
secretsOverview = config.NO_SECRETS_DEFAULT
}
overview := formatter.CreateOverview("MOVE OVERVIEW", rows)
volumesOverview := strings.Join(volumes, "\n")
if len(volumes) == 0 {
volumesOverview = config.NO_VOLUMES_DEFAULT
}
rows := [][]string{
{i18n.G("DOMAIN"), domain},
{i18n.G("RECIPE"), app.Recipe.Name},
{i18n.G("OLD SERVER"), server},
{i18n.G("NEW SERVER"), newServer},
{i18n.G("SECRETS"), secretsOverview},
{i18n.G("VOLUMES"), volumesOverview},
}
overview := formatter.CreateOverview(i18n.G("MOVE OVERVIEW"), rows)
fmt.Println(overview)
}
@ -179,17 +189,17 @@ func PromptProcced() error {
}
if Dry {
return fmt.Errorf("dry run")
return errors.New(i18n.G("dry run"))
}
response := false
prompt := &survey.Confirm{Message: "proceed?"}
prompt := &survey.Confirm{Message: i18n.G("proceed?")}
if err := survey.AskOne(prompt, &response); err != nil {
return err
}
if !response {
return errors.New("cancelled")
return errors.New(i18n.G("cancelled"))
}
return nil