From 6c3faf25c2c3fe366b75d898ea0827d2160d9e0f Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Tue, 18 Oct 2022 15:48:28 +0200 Subject: [PATCH 1/3] fix: use 'kong.yaml' as default output-file for 'convert' Right now, if no `--output-file` is provided, decK creates a new `.yaml` file in the current directory. This commit make sure `kong.yaml` is used as default when no `--output-file` is used. --- cmd/convert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/convert.go b/cmd/convert.go index 62b84dffe..9cf7ffbec 100644 --- a/cmd/convert.go +++ b/cmd/convert.go @@ -80,7 +80,7 @@ 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.") return convertCmd } From 219e9d7b6bf5ed42c8010988fe96742aba05ccb0 Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Tue, 18 Oct 2022 15:53:38 +0200 Subject: [PATCH 2/3] feat: add '--yes' flag to 'convert' subcommand --- cmd/convert.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/convert.go b/cmd/convert.go index 9cf7ffbec..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 @@ -82,6 +85,8 @@ can be converted into a 'konnect' configuration file.`, "configuration file to be converted. Use `-` to read from stdin.") 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 } From 578a86ed53722d6a85232789b9b2dacde9bc4bbe Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Tue, 18 Oct 2022 15:58:42 +0200 Subject: [PATCH 3/3] docs: add changelog for 'convert' changes --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) 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`