From 8f58a603eaa1adb58686d16033168664e894c72c Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Wed, 18 Oct 2017 00:00:01 +0200 Subject: [PATCH] commands: get HTTP API flags for usage automatically --- command/agent/agent.go | 2 +- command/catalog/catalog.go | 2 +- .../list/dc/catalog_list_datacenters.go | 2 +- .../catalog/list/nodes/catalog_list_nodes.go | 2 +- .../list/services/catalog_list_services.go | 2 +- command/event/event.go | 2 +- command/exec/exec.go | 2 +- command/flags/merge.go | 2 +- command/flags/usage.go | 81 +++++++++---------- command/forceleave/forceleave.go | 2 +- command/info/info.go | 2 +- command/join/join.go | 2 +- command/keygen/keygen.go | 2 +- command/keyring/keyring.go | 2 +- command/kv/del/kv_delete.go | 2 +- command/kv/exp/kv_export.go | 2 +- command/kv/get/kv_get.go | 2 +- command/kv/imp/kv_import.go | 2 +- command/kv/kv.go | 2 +- command/kv/put/kv_put.go | 2 +- command/leave/leave.go | 2 +- command/lock/lock.go | 2 +- command/maint/maint.go | 2 +- command/members/members.go | 2 +- command/monitor/monitor.go | 2 +- .../autopilot/get/operator_autopilot_get.go | 2 +- .../operator/autopilot/operator_autopilot.go | 2 +- .../autopilot/set/operator_autopilot_set.go | 2 +- command/operator/operator.go | 2 +- .../raft/listpeers/operator_raft_list.go | 2 +- command/operator/raft/operator_raft.go | 2 +- .../raft/removepeer/operator_raft_remove.go | 2 +- command/reload/reload.go | 2 +- command/rtt/rtt.go | 2 +- command/snapshot/inspect/snapshot_inspect.go | 2 +- command/snapshot/restore/snapshot_restore.go | 2 +- command/snapshot/save/snapshot_save.go | 2 +- command/snapshot/snapshot_command.go | 2 +- command/validate/validate.go | 2 +- command/watch/watch.go | 2 +- 40 files changed, 79 insertions(+), 80 deletions(-) diff --git a/command/agent/agent.go b/command/agent/agent.go index 9b6a0b36e..44c60ff72 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 8c91610bd..04e2e4fbe 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 dcea8c969..f9b923ad8 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 f0b78126c..93488da37 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 bd14206cb..fb769e804 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 2eb16520b..0b12f72fc 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 b73709a15..0cdb72397 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 0409824eb..86b6c774c 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 ac02f0da1..64b406102 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 df9b947e3..1f5d308e3 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 965c42e96..b8b3900c8 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 5dfd83ec6..306e0836e 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 b2f3d795b..0b9590773 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 573cf2cbd..33c329792 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 50ab16275..a0716c599 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 34e4de4c9..97030c5ae 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 4192a51b2..93faf94e7 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 c6be3a5fd..ad0d8d4f3 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 52be305ec..1a5d6a345 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 3dab4950d..f057f0297 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 ab1625f75..7653d717b 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 728be01ed..cb7db04c7 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 896315e9a..b35df592c 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 697c5e5c0..4c3ff92e1 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 3bff5cf64..e3c33bb77 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 da5dba4e7..ed0c897f5 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 89b768a11..53a239a95 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 93cf5419c..c17c7bb2e 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 8bdf41b2d..d56881eee 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 6302f6299..ae5a39868 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 a10125c5c..f3cedbc56 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 3a2d16512..7fcbc44a8 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 16a3d9227..16fed1c7f 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 f300ef20a..21e174157 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 9a83308af..78423e76f 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 bc9611d17..ae09f0f40 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 9e15eff74..a245cec64 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 9feb190a6..0ef9af526 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 1f308cde0..2ea4d3362 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 c138386b4..173464718 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 {