Commit 89f6054f authored by Danielle Lancashire's avatar Danielle Lancashire
Browse files

status: Allow passing -verbose to meta status

A common issue when using nomad is needing to add in the object verb to
a command to include the `-verbose` flag.

This commit allows users to pass `-verbose` via the `nomad status` alias by
adding a placeholder boolean in the metacommand which allows subcommands
to parse the flag.
parent 010b9575
Showing with 11 additions and 1 deletion
+11 -1
......@@ -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 {
......@@ -23,7 +26,13 @@ Usage: nomad status [options] <identifier>
General Options:
` + generalOptionsUsage()
` + generalOptionsUsage() + `
Status Options:
-verbose
Display full information.
`
return strings.TrimSpace(helpText)
}
......@@ -65,6 +74,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))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment