diff --git a/README.md b/README.md index 51a2ddc..a39916b 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ $ helm 2to3 move config [flags] Flags: --dry-run simulate a command + --skip-confirmation if set, skips confirmation message before performing move -h, --help help for move ``` diff --git a/cmd/move_config.go b/cmd/move_config.go index fd08725..944f947 100644 --- a/cmd/move_config.go +++ b/cmd/move_config.go @@ -41,7 +41,7 @@ func newMoveConfigCmd(out io.Writer) *cobra.Command { flags := cmd.Flags() settings.AddBaseFlags(flags) - + flags.BoolVar(&skipConfirmation, "skip-confirmation", false, "if set, skips confirmation message before performing move") return cmd } @@ -58,6 +58,8 @@ func runMove(cmd *cobra.Command, args []string) error { // Moves/copies v2 configuration to v2 configuration. It copies repository config, // plugins and starters. It does not copy cache. func Move(dryRun bool) error { + var err error + var doConfig bool if dryRun { log.Println("NOTE: This is in dry-run mode, the following actions will not be executed.") log.Println("Run without --dry-run to take the actions described below:") @@ -66,12 +68,18 @@ func Move(dryRun bool) error { log.Println("WARNING: Helm v3 configuration may be overwritten during this operation.") log.Println() - doCleanup, err := utils.AskConfirmation("Move Config", "move the v2 configuration") - if err != nil { - return err + if skipConfirmation { + + log.Println("Skipping confirmation before performing move configuration.") + doConfig = true + } else { + doConfig, err = utils.AskConfirmation("Move config", "move the v2 configuration") + if err != nil { + return err + } } - if !doCleanup { - log.Println("Move configuration will not proceed as the user didn't answer (Y|y) in order to continue.") + if !doConfig { + log.Println("Move will not proceed as the user didn't answer (Y|y) in order to continue.") return nil } diff --git a/completion.yaml b/completion.yaml index b01cdc1..cf8a59d 100644 --- a/completion.yaml +++ b/completion.yaml @@ -31,3 +31,4 @@ commands: - name: config flags: - dry-run + - skip-confirmation diff --git a/plugin.yaml b/plugin.yaml index d610e9f..4a51dba 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: "2to3" -version: "0.6.0" +version: "0.7.0" usage: "migrate and cleanup Helm v2 configuration and releases in-place to Helm v3" description: "migrate and cleanup Helm v2 configuration and releases in-place to Helm v3" command: "$HELM_PLUGIN_DIR/bin/2to3"