commands: cleanup init

This commit is contained in:
Frank Schroeder 2017-10-18 02:38:26 +02:00
parent f0f8612551
commit 4f6abf1e72
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
3 changed files with 8 additions and 9 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}