cli: fix missing `-quiet` flag for `var init` (#17526)
The `var init` command was intended to have support for a `-quiet` flag but it was not documented and never parsed.
This commit is contained in:
parent
736ad3ed32
commit
5f509b8ce0
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
cli: Add `-quiet` flag to `nomad var init` command
|
||||||
|
```
|
|
@ -44,6 +44,8 @@ Init Options:
|
||||||
-out (hcl | json)
|
-out (hcl | json)
|
||||||
Format of generated variable specification. Defaults to "hcl".
|
Format of generated variable specification. Defaults to "hcl".
|
||||||
|
|
||||||
|
-quiet
|
||||||
|
Do not print success message.
|
||||||
`
|
`
|
||||||
return strings.TrimSpace(helpText)
|
return strings.TrimSpace(helpText)
|
||||||
}
|
}
|
||||||
|
@ -54,7 +56,8 @@ func (c *VarInitCommand) Synopsis() string {
|
||||||
|
|
||||||
func (c *VarInitCommand) AutocompleteFlags() complete.Flags {
|
func (c *VarInitCommand) AutocompleteFlags() complete.Flags {
|
||||||
return complete.Flags{
|
return complete.Flags{
|
||||||
"-out": complete.PredictSet("hcl", "json"),
|
"-out": complete.PredictSet("hcl", "json"),
|
||||||
|
"-quiet": complete.PredictNothing,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +74,7 @@ func (c *VarInitCommand) Run(args []string) int {
|
||||||
flags := c.Meta.FlagSet(c.Name(), FlagSetClient)
|
flags := c.Meta.FlagSet(c.Name(), FlagSetClient)
|
||||||
flags.Usage = func() { c.Ui.Output(c.Help()) }
|
flags.Usage = func() { c.Ui.Output(c.Help()) }
|
||||||
flags.StringVar(&outFmt, "out", "hcl", "")
|
flags.StringVar(&outFmt, "out", "hcl", "")
|
||||||
|
flags.BoolVar(&quiet, "quiet", false, "")
|
||||||
|
|
||||||
if err := flags.Parse(args); err != nil {
|
if err := flags.Parse(args); err != nil {
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -24,6 +24,8 @@ When no filename is supplied, a default filename of "spec.nv.hcl" or
|
||||||
- `-out` `(enum: hcl | json)`: Format of generated variable
|
- `-out` `(enum: hcl | json)`: Format of generated variable
|
||||||
specification. Defaults to `hcl`.
|
specification. Defaults to `hcl`.
|
||||||
|
|
||||||
|
- `-quiet`: Do not print success message.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Create an example variable specification:
|
Create an example variable specification:
|
||||||
|
|
Loading…
Reference in New Issue