diff --git a/command/forceleave/forceleave.go b/command/forceleave/forceleave.go index 6359c56c5..a8a951421 100644 --- a/command/forceleave/forceleave.go +++ b/command/forceleave/forceleave.go @@ -10,7 +10,7 @@ import ( func New(ui cli.Ui) *cmd { c := &cmd{UI: ui} - c.initFlags() + c.init() return c } @@ -18,13 +18,15 @@ type cmd struct { UI cli.Ui flags *flag.FlagSet http *flags.HTTPFlags + usage string } -func (c *cmd) initFlags() { +func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ServerFlags()) + c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) } func (c *cmd) Run(args []string) int { @@ -60,7 +62,10 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - s := `Usage: consul force-leave [options] name + return c.usage +} + +const usage = `Usage: consul force-leave [options] name Forces a member of a Consul cluster to enter the "left" state. Note that if the member is still actually alive, it will eventually rejoin @@ -68,6 +73,3 @@ func (c *cmd) Help() string { that are never coming back. If you do not force leave a failed node, Consul will attempt to reconnect to those failed nodes for some period of time before eventually reaping them.` - - return flags.Usage(s, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) -} diff --git a/command/info/info.go b/command/info/info.go index 54fe7fb62..329911251 100644 --- a/command/info/info.go +++ b/command/info/info.go @@ -11,7 +11,7 @@ import ( func New(ui cli.Ui) *cmd { c := &cmd{UI: ui} - c.initFlags() + c.init() return c } @@ -19,12 +19,14 @@ type cmd struct { UI cli.Ui flags *flag.FlagSet http *flags.HTTPFlags + usage string } -func (c *cmd) initFlags() { +func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) + c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil) } func (c *cmd) Run(args []string) int { @@ -86,9 +88,9 @@ func (c *cmd) Synopsis() string { } func (c *cmd) Help() string { - s := `Usage: consul info [options] + return c.usage +} + +const usage = `Usage: consul info [options] Provides debugging information for operators` - - return flags.Usage(s, c.flags, c.http.ClientFlags(), nil) -}