Skip to content

Commit

Permalink
Merge pull request #5516 from hashicorp/dani/f-verbose-status
Browse files Browse the repository at this point in the history
Allow passing -verbose to meta status
  • Loading branch information
endocrimes committed Apr 11, 2019
2 parents 1c06fd5 + 38e73b5 commit 7764778
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions command/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (

type StatusCommand struct {
Meta

// Placeholder bool to allow passing of verbose flags to subcommands.
verbose bool
}

func (s *StatusCommand) Help() string {
Expand All @@ -23,7 +26,13 @@ Usage: nomad status [options] <identifier>
General Options:
` + generalOptionsUsage()
` + generalOptionsUsage() + `
Status Options:
-verbose
Display full information.
`

return strings.TrimSpace(helpText)
}
Expand All @@ -33,7 +42,10 @@ func (c *StatusCommand) Synopsis() string {
}

func (c *StatusCommand) AutocompleteFlags() complete.Flags {
return c.Meta.AutocompleteFlags(FlagSetClient)
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-verbose": complete.PredictNothing,
})
}

func (c *StatusCommand) AutocompleteArgs() complete.Predictor {
Expand Down Expand Up @@ -65,6 +77,7 @@ func (c *StatusCommand) AutocompleteArgs() complete.Predictor {
func (c *StatusCommand) Run(args []string) int {
flags := c.Meta.FlagSet("status", FlagSetClient)
flags.Usage = func() { c.Ui.Output(c.Help()) }
flags.BoolVar(&c.verbose, "verbose", false, "")

if err := flags.Parse(args); err != nil {
c.Ui.Error(fmt.Sprintf("Error parsing arguments: %q", err))
Expand Down

0 comments on commit 7764778

Please sign in to comment.