From 4f6abf1e728baf6f316f2bb3d330d788a97c726e Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Wed, 18 Oct 2017 02:38:26 +0200 Subject: [PATCH] commands: cleanup init --- command/maint/maint.go | 5 ++--- command/members/members.go | 7 ++++--- command/monitor/monitor.go | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/command/maint/maint.go b/command/maint/maint.go index b35df592c..2524d8e17 100644 --- a/command/maint/maint.go +++ b/command/maint/maint.go @@ -32,9 +32,6 @@ func New(ui cli.Ui) *cmd { func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) - c.http = &flags.HTTPFlags{} - flags.Merge(c.flags, c.http.ClientFlags()) - c.flags.BoolVar(&c.enable, "enable", false, "Enable maintenance mode.") c.flags.BoolVar(&c.disable, "disable", false, @@ -44,6 +41,8 @@ func (c *cmd) init() { c.flags.StringVar(&c.serviceID, "service", "", "Control maintenance mode for a specific service ID.") + c.http = &flags.HTTPFlags{} + flags.Merge(c.flags, c.http.ClientFlags()) c.help = flags.Usage(help, c.flags) } diff --git a/command/members/members.go b/command/members/members.go index 4c3ff92e1..6def2231d 100644 --- a/command/members/members.go +++ b/command/members/members.go @@ -22,6 +22,7 @@ type cmd struct { help string flags *flag.FlagSet http *flags.HTTPFlags + // flags detailed bool wan bool @@ -37,9 +38,6 @@ func New(ui cli.Ui) *cmd { func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) - c.http = &flags.HTTPFlags{} - flags.Merge(c.flags, c.http.ClientFlags()) - c.flags.BoolVar(&c.detailed, "detailed", false, "Provides detailed information about nodes.") c.flags.BoolVar(&c.wan, "wan", false, @@ -51,6 +49,9 @@ 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.http = &flags.HTTPFlags{} + flags.Merge(c.flags, c.http.ClientFlags()) c.help = flags.Usage(help, c.flags) } diff --git a/command/monitor/monitor.go b/command/monitor/monitor.go index e3c33bb77..502a0fd58 100644 --- a/command/monitor/monitor.go +++ b/command/monitor/monitor.go @@ -34,12 +34,11 @@ func New(ui cli.Ui, shutdownCh <-chan struct{}) *cmd { func (c *cmd) init() { c.flags = flag.NewFlagSet("", flag.ContinueOnError) - c.http = &flags.HTTPFlags{} - flags.Merge(c.flags, c.http.ClientFlags()) - c.flags.StringVar(&c.logLevel, "log-level", "INFO", "Log level of the agent.") + c.http = &flags.HTTPFlags{} + flags.Merge(c.flags, c.http.ClientFlags()) c.help = flags.Usage(help, c.flags) }