Skip to content

Commit

Permalink
cli: fix missing -quiet flag for var init
Browse files Browse the repository at this point in the history
The `var init` command was intended to have support for a `-quiet` flag but it
was not documented and never parsed.
  • Loading branch information
tgross committed Jun 14, 2023
1 parent ee8cf15 commit c9fa48b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion command/var_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func (c *VarInitCommand) Synopsis() string {

func (c *VarInitCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-out": complete.PredictSet("hcl", "json"),
"-out": complete.PredictSet("hcl", "json"),
"-quiet": complete.PredictNothing,
}
}

Expand All @@ -71,6 +72,7 @@ func (c *VarInitCommand) Run(args []string) int {
flags := c.Meta.FlagSet(c.Name(), FlagSetClient)
flags.Usage = func() { c.Ui.Output(c.Help()) }
flags.StringVar(&outFmt, "out", "hcl", "")
flags.BoolVar(&quiet, "quiet", false, "")

if err := flags.Parse(args); err != nil {
return 1
Expand Down
2 changes: 2 additions & 0 deletions website/content/docs/commands/var/init.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
specification. Defaults to `hcl`.

- `-quiet`: Do not print success message.

## Examples

Create an example variable specification:
Expand Down

0 comments on commit c9fa48b

Please sign in to comment.