diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d939c097..314013342 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,11 +52,17 @@ ### Added +- Add `--yes` flag to `convert` subcommand to bypass + user confirmation and run non-interactively. + [#775](https://github.com/Kong/deck/pull/775) - Add support to Kong Vaults. [#761](https://github.com/Kong/deck/pull/761) ### Fixes +- Use `kong.yaml` as default value with `convert` subcommand + when no `--output-file` is provided. + [#775](https://github.com/Kong/deck/pull/775) - Add `-w` shorthand flag support to `sync`. [#765](https://github.com/Kong/deck/pull/765) - Handle correctly encoded whitespaces into services' `url` diff --git a/cmd/convert.go b/cmd/convert.go index 62b84dffe..4e0fac656 100644 --- a/cmd/convert.go +++ b/cmd/convert.go @@ -15,6 +15,7 @@ var ( convertCmdDestinationFormat string convertCmdInputFile string convertCmdOutputFile string + convertCmdAssumeYes bool ) // newConvertCmd represents the convert command @@ -37,7 +38,9 @@ can be converted into a 'konnect' configuration file.`, } if convertCmdInputFile != "" { - if yes, err := utils.ConfirmFileOverwrite(convertCmdOutputFile, "", false); err != nil { + if yes, err := utils.ConfirmFileOverwrite( + convertCmdOutputFile, "", convertCmdAssumeYes, + ); err != nil { return err } else if !yes { return nil @@ -80,8 +83,10 @@ can be converted into a 'konnect' configuration file.`, fmt.Sprintf("desired format of the output, allowed formats: %v", destinationFormats)) convertCmd.Flags().StringVar(&convertCmdInputFile, "input-file", "", "configuration file to be converted. Use `-` to read from stdin.") - convertCmd.Flags().StringVar(&convertCmdOutputFile, "output-file", "", + convertCmd.Flags().StringVar(&convertCmdOutputFile, "output-file", "kong.yaml", "file to write configuration to after conversion. Use `-` to write to stdout.") + convertCmd.Flags().BoolVar(&convertCmdAssumeYes, "yes", + false, "assume `yes` to prompts and run non-interactively.") return convertCmd }