Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing -verbose to meta status #5516

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
endocrimes marked this conversation as resolved.
Show resolved Hide resolved
`

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