kinflate: added set subcommand

This commit is contained in:
Sunil Arora 2018-02-07 12:39:13 -08:00
parent 6daa07ef04
commit c738ff9a19
2 changed files with 23 additions and 3 deletions

View File

@ -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 <prefix-value>
`,
Args: cobra.MinimumNArgs(1),
}
c.AddCommand(
newCmdSetNamePrefix(stdOut, stdErr, fsys),
)
return c
}

View File

@ -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.
`,