From c738ff9a19ae861d43631bfb813072ce32938a28 Mon Sep 17 00:00:00 2001 From: Sunil Arora Date: Wed, 7 Feb 2018 12:39:13 -0800 Subject: [PATCH] kinflate: added set subcommand --- pkg/kinflate/commands/commands.go | 22 +++++++++++++++++++++- pkg/kinflate/commands/set_name_prefix.go | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pkg/kinflate/commands/commands.go b/pkg/kinflate/commands/commands.go index c1c622ca8..2330bc090 100644 --- a/pkg/kinflate/commands/commands.go +++ b/pkg/kinflate/commands/commands.go @@ -41,11 +41,12 @@ Find more information at: } c.AddCommand( - newCmdSetNamePrefix(stdOut, stdErr, fsys), newCmdInflate(stdOut, stdErr), newCmdInit(stdOut, stdErr, fsys), // 'add' sub command newCmdAdd(stdOut, stdErr, fsys), + // 'set' sub command + newCmdSet(stdOut, stdErr, fsys), ) return c @@ -76,3 +77,22 @@ func newCmdAdd(stdOut, stdErr io.Writer, fsys fs.FileSystem) *cobra.Command { ) return c } + +// newSetCommand returns an instance of 'set' subcommand. +func newCmdSet(stdOut, stdErr io.Writer, fsys fs.FileSystem) *cobra.Command { + c := &cobra.Command{ + Use: "set", + Short: "Sets the value of different fields in manifest.", + Long: "", + Example: ` + # Sets the nameprefix field + kinflate set nameprefix +`, + Args: cobra.MinimumNArgs(1), + } + + c.AddCommand( + newCmdSetNamePrefix(stdOut, stdErr, fsys), + ) + return c +} diff --git a/pkg/kinflate/commands/set_name_prefix.go b/pkg/kinflate/commands/set_name_prefix.go index 758e48cd5..d0281a579 100644 --- a/pkg/kinflate/commands/set_name_prefix.go +++ b/pkg/kinflate/commands/set_name_prefix.go @@ -38,13 +38,13 @@ func newCmdSetNamePrefix(out, errOut io.Writer, fsys fs.FileSystem) *cobra.Comma var o setNamePrefixOptions cmd := &cobra.Command{ - Use: "setnameprefix", + Use: "nameprefix", Short: "Sets the value of the namePrefix field in the manifest.", Long: "Sets the value of the namePrefix field in the manifest.", // Example: ` The command - setnameprefix acme- + set nameprefix acme- will add the field "namePrefix: acme-" to the manifest file if it doesn't exist, and overwrite the value with "acme-" if the field does exist. `,