diff --git a/command/agent/agent.go b/command/agent/agent.go index 9b6a0b36e9..44c60ff722 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -70,7 +70,7 @@ type cmd struct { func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) config.AddFlags(c.flags, &c.flagArgs) - c.help = flags.Usage(help, c.flags, nil, nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/catalog/catalog.go b/command/catalog/catalog.go index 8c91610bd6..04e2e4fbec 100644 --- a/command/catalog/catalog.go +++ b/command/catalog/catalog.go @@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - return flags.Usage(help, nil, nil, nil) + return flags.Usage(help, nil) } const synopsis = "Interact with the catalog" diff --git a/command/catalog/list/dc/catalog_list_datacenters.go b/command/catalog/list/dc/catalog_list_datacenters.go index dcea8c969b..f9b923ad89 100644 --- a/command/catalog/list/dc/catalog_list_datacenters.go +++ b/command/catalog/list/dc/catalog_list_datacenters.go @@ -26,7 +26,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/catalog/list/nodes/catalog_list_nodes.go b/command/catalog/list/nodes/catalog_list_nodes.go index f0b78126cb..93488da373 100644 --- a/command/catalog/list/nodes/catalog_list_nodes.go +++ b/command/catalog/list/nodes/catalog_list_nodes.go @@ -48,7 +48,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/catalog/list/services/catalog_list_services.go b/command/catalog/list/services/catalog_list_services.go index bd14206cbf..fb769e804d 100644 --- a/command/catalog/list/services/catalog_list_services.go +++ b/command/catalog/list/services/catalog_list_services.go @@ -46,7 +46,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/event/event.go b/command/event/event.go index 2eb16520b6..0b12f72fcb 100644 --- a/command/event/event.go +++ b/command/event/event.go @@ -40,7 +40,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/exec/exec.go b/command/exec/exec.go index b73709a155..0cdb723975 100644 --- a/command/exec/exec.go +++ b/command/exec/exec.go @@ -60,7 +60,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/flags/merge.go b/command/flags/merge.go index 0409824eb9..86b6c774c9 100644 --- a/command/flags/merge.go +++ b/command/flags/merge.go @@ -10,6 +10,6 @@ func Merge(dst, src *flag.FlagSet) { return } src.VisitAll(func(f *flag.Flag) { - dst.Var(f.Value, f.Name, f.DefValue) + dst.Var(f.Value, f.Name, f.Usage) }) } diff --git a/command/flags/usage.go b/command/flags/usage.go index ac02f0da19..64b4061022 100644 --- a/command/flags/usage.go +++ b/command/flags/usage.go @@ -10,21 +10,17 @@ import ( text "github.com/tonnerre/golang-text" ) -func Usage(txt string, cmdFlags, clientFlags, serverFlags *flag.FlagSet) string { +func Usage(txt string, flags *flag.FlagSet) string { u := &Usager{ - Usage: txt, - CmdFlags: cmdFlags, - HTTPClientFlags: clientFlags, - HTTPServerFlags: serverFlags, + Usage: txt, + Flags: flags, } return u.String() } type Usager struct { - Usage string - CmdFlags *flag.FlagSet - HTTPClientFlags *flag.FlagSet - HTTPServerFlags *flag.FlagSet + Usage string + Flags *flag.FlagSet } func (u *Usager) String() string { @@ -33,28 +29,39 @@ func (u *Usager) String() string { out.WriteString("\n") out.WriteString("\n") - httpFlags := u.HTTPClientFlags - if httpFlags == nil { - httpFlags = u.HTTPServerFlags - } else { - Merge(httpFlags, u.HTTPServerFlags) - } + if u.Flags != nil { + f := &HTTPFlags{} + clientFlags := f.ClientFlags() + serverFlags := f.ServerFlags() - if httpFlags != nil { - printTitle(out, "HTTP API Options") - httpFlags.VisitAll(func(f *flag.Flag) { - printFlag(out, f) - }) - } - - if u.CmdFlags != nil { - printTitle(out, "Command Options") - u.CmdFlags.VisitAll(func(f *flag.Flag) { - if flagContains(httpFlags, f) { - return + var httpFlags, cmdFlags *flag.FlagSet + u.Flags.VisitAll(func(f *flag.Flag) { + if contains(clientFlags, f) || contains(serverFlags, f) { + if httpFlags == nil { + httpFlags = flag.NewFlagSet("", flag.ContinueOnError) + } + httpFlags.Var(f.Value, f.Name, f.Usage) + } else { + if cmdFlags == nil { + cmdFlags = flag.NewFlagSet("", flag.ContinueOnError) + } + cmdFlags.Var(f.Value, f.Name, f.Usage) } - printFlag(out, f) }) + + if httpFlags != nil { + printTitle(out, "HTTP API Options") + httpFlags.VisitAll(func(f *flag.Flag) { + printFlag(out, f) + }) + } + + if cmdFlags != nil { + printTitle(out, "Command Options") + cmdFlags.VisitAll(func(f *flag.Flag) { + printFlag(out, f) + }) + } } return strings.TrimRight(out.String(), "\n") @@ -78,26 +85,18 @@ func printFlag(w io.Writer, f *flag.Flag) { fmt.Fprintf(w, "%s\n\n", indented) } -// flagContains returns true if the given flag is contained in the given flag +// contains returns true if the given flag is contained in the given flag // set or false otherwise. -func flagContains(fs *flag.FlagSet, f *flag.Flag) bool { +func contains(fs *flag.FlagSet, f *flag.Flag) bool { if fs == nil { return false } - var skip bool + var in bool fs.VisitAll(func(hf *flag.Flag) { - if skip { - return - } - - if f.Name == hf.Name { - skip = true - return - } + in = in || f.Name == hf.Name }) - - return skip + return in } // maxLineLength is the maximum width of any line. diff --git a/command/forceleave/forceleave.go b/command/forceleave/forceleave.go index df9b947e33..1f5d308e3a 100644 --- a/command/forceleave/forceleave.go +++ b/command/forceleave/forceleave.go @@ -25,7 +25,7 @@ func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/info/info.go b/command/info/info.go index 965c42e960..b8b3900c83 100644 --- a/command/info/info.go +++ b/command/info/info.go @@ -26,7 +26,7 @@ func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/join/join.go b/command/join/join.go index 5dfd83ec68..306e0836ee 100644 --- a/command/join/join.go +++ b/command/join/join.go @@ -29,7 +29,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/keygen/keygen.go b/command/keygen/keygen.go index b2f3d795b3..0b95907736 100644 --- a/command/keygen/keygen.go +++ b/command/keygen/keygen.go @@ -24,7 +24,7 @@ type cmd struct { func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) - c.help = flags.Usage(help, c.flags, nil, nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/keyring/keyring.go b/command/keyring/keyring.go index 573cf2cbd3..33c3297920 100644 --- a/command/keyring/keyring.go +++ b/command/keyring/keyring.go @@ -51,7 +51,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/kv/del/kv_delete.go b/command/kv/del/kv_delete.go index 50ab16275c..a0716c5995 100644 --- a/command/kv/del/kv_delete.go +++ b/command/kv/del/kv_delete.go @@ -39,7 +39,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/kv/exp/kv_export.go b/command/kv/exp/kv_export.go index 34e4de4c9e..97030c5ae8 100644 --- a/command/kv/exp/kv_export.go +++ b/command/kv/exp/kv_export.go @@ -29,7 +29,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/kv/get/kv_get.go b/command/kv/get/kv_get.go index 4192a51b2f..93faf94e7c 100644 --- a/command/kv/get/kv_get.go +++ b/command/kv/get/kv_get.go @@ -54,7 +54,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/kv/imp/kv_import.go b/command/kv/imp/kv_import.go index c6be3a5fd7..ad0d8d4f3a 100644 --- a/command/kv/imp/kv_import.go +++ b/command/kv/imp/kv_import.go @@ -38,7 +38,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/kv/kv.go b/command/kv/kv.go index 52be305ec7..1a5d6a3452 100644 --- a/command/kv/kv.go +++ b/command/kv/kv.go @@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - return flags.Usage(help, nil, nil, nil) + return flags.Usage(help, nil) } const synopsis = "Interact with the key-value store" diff --git a/command/kv/put/kv_put.go b/command/kv/put/kv_put.go index 3dab4950d4..f057f02972 100644 --- a/command/kv/put/kv_put.go +++ b/command/kv/put/kv_put.go @@ -70,7 +70,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/leave/leave.go b/command/leave/leave.go index ab1625f756..7653d717b7 100644 --- a/command/leave/leave.go +++ b/command/leave/leave.go @@ -25,7 +25,7 @@ func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/lock/lock.go b/command/lock/lock.go index 728be01edc..cb7db04c7b 100644 --- a/command/lock/lock.go +++ b/command/lock/lock.go @@ -103,7 +103,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/maint/maint.go b/command/maint/maint.go index 896315e9a1..b35df592c8 100644 --- a/command/maint/maint.go +++ b/command/maint/maint.go @@ -44,7 +44,7 @@ func (c *cmd) init() { c.flags.StringVar(&c.serviceID, "service", "", "Control maintenance mode for a specific service ID.") - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/members/members.go b/command/members/members.go index 697c5e5c01..4c3ff92e1a 100644 --- a/command/members/members.go +++ b/command/members/members.go @@ -51,7 +51,7 @@ func (c *cmd) init() { c.flags.StringVar(&c.segment, "segment", consulapi.AllSegments, "(Enterprise-only) If provided, output is filtered to only nodes in"+ "the given segment.") - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/monitor/monitor.go b/command/monitor/monitor.go index 3bff5cf649..e3c33bb776 100644 --- a/command/monitor/monitor.go +++ b/command/monitor/monitor.go @@ -40,7 +40,7 @@ func (c *cmd) init() { c.flags.StringVar(&c.logLevel, "log-level", "INFO", "Log level of the agent.") - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/operator/autopilot/get/operator_autopilot_get.go b/command/operator/autopilot/get/operator_autopilot_get.go index da5dba4e70..ed0c897f56 100644 --- a/command/operator/autopilot/get/operator_autopilot_get.go +++ b/command/operator/autopilot/get/operator_autopilot_get.go @@ -27,7 +27,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/operator/autopilot/operator_autopilot.go b/command/operator/autopilot/operator_autopilot.go index 89b768a112..53a239a954 100644 --- a/command/operator/autopilot/operator_autopilot.go +++ b/command/operator/autopilot/operator_autopilot.go @@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - return flags.Usage(help, nil, nil, nil) + return flags.Usage(help, nil) } const synopsis = "Provides tools for modifying Autopilot configuration" diff --git a/command/operator/autopilot/set/operator_autopilot_set.go b/command/operator/autopilot/set/operator_autopilot_set.go index 93cf5419c7..c17c7bb2ea 100644 --- a/command/operator/autopilot/set/operator_autopilot_set.go +++ b/command/operator/autopilot/set/operator_autopilot_set.go @@ -62,7 +62,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/operator/operator.go b/command/operator/operator.go index 8bdf41b2dc..d56881eee5 100644 --- a/command/operator/operator.go +++ b/command/operator/operator.go @@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - return flags.Usage(help, nil, nil, nil) + return flags.Usage(help, nil) } const synopsis = "Provides cluster-level tools for Consul operators" diff --git a/command/operator/raft/listpeers/operator_raft_list.go b/command/operator/raft/listpeers/operator_raft_list.go index 6302f62995..ae5a39868e 100644 --- a/command/operator/raft/listpeers/operator_raft_list.go +++ b/command/operator/raft/listpeers/operator_raft_list.go @@ -28,7 +28,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/operator/raft/operator_raft.go b/command/operator/raft/operator_raft.go index a10125c5cf..f3cedbc567 100644 --- a/command/operator/raft/operator_raft.go +++ b/command/operator/raft/operator_raft.go @@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - return flags.Usage(help, nil, nil, nil) + return flags.Usage(help, nil) } const synopsis = "Provides cluster-level tools for Consul operators" diff --git a/command/operator/raft/removepeer/operator_raft_remove.go b/command/operator/raft/removepeer/operator_raft_remove.go index 3a2d165126..7fcbc44a81 100644 --- a/command/operator/raft/removepeer/operator_raft_remove.go +++ b/command/operator/raft/removepeer/operator_raft_remove.go @@ -36,7 +36,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/reload/reload.go b/command/reload/reload.go index 16a3d92274..16fed1c7f8 100644 --- a/command/reload/reload.go +++ b/command/reload/reload.go @@ -25,7 +25,7 @@ func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/rtt/rtt.go b/command/rtt/rtt.go index f300ef20a0..21e174157e 100644 --- a/command/rtt/rtt.go +++ b/command/rtt/rtt.go @@ -34,7 +34,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/snapshot/inspect/snapshot_inspect.go b/command/snapshot/inspect/snapshot_inspect.go index 9a83308af7..78423e76f8 100644 --- a/command/snapshot/inspect/snapshot_inspect.go +++ b/command/snapshot/inspect/snapshot_inspect.go @@ -26,7 +26,7 @@ type cmd struct { func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) - c.help = flags.Usage(help, c.flags, nil, nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/snapshot/restore/snapshot_restore.go b/command/snapshot/restore/snapshot_restore.go index bc9611d175..ae09f0f40b 100644 --- a/command/snapshot/restore/snapshot_restore.go +++ b/command/snapshot/restore/snapshot_restore.go @@ -27,7 +27,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/snapshot/save/snapshot_save.go b/command/snapshot/save/snapshot_save.go index 9e15eff743..a245cec646 100644 --- a/command/snapshot/save/snapshot_save.go +++ b/command/snapshot/save/snapshot_save.go @@ -30,7 +30,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/snapshot/snapshot_command.go b/command/snapshot/snapshot_command.go index 9feb190a64..0ef9af526a 100644 --- a/command/snapshot/snapshot_command.go +++ b/command/snapshot/snapshot_command.go @@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - return flags.Usage(help, nil, nil, nil) + return flags.Usage(help, nil) } const synopsis = "Saves, restores and inspects snapshots of Consul server state" diff --git a/command/validate/validate.go b/command/validate/validate.go index 1f308cde0d..2ea4d33622 100644 --- a/command/validate/validate.go +++ b/command/validate/validate.go @@ -26,7 +26,7 @@ func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags.BoolVar(&c.quiet, "quiet", false, "When given, a successful run will produce no output.") - c.help = flags.Usage(help, c.flags, nil, nil) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int { diff --git a/command/watch/watch.go b/command/watch/watch.go index c138386b4b..1734647182 100644 --- a/command/watch/watch.go +++ b/command/watch/watch.go @@ -70,7 +70,7 @@ func (c *cmd) init() { c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) - c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) + c.help = flags.Usage(help, c.flags) } func (c *cmd) Run(args []string) int {