Browse Source

Fix join command to build help string in constructor

pull/3584/head
Preetha Appan 7 years ago committed by Frank Schröder
parent
commit
85a834d008
  1. 14
      command/join/join.go

14
command/join/join.go

@ -10,7 +10,7 @@ import (
func New(ui cli.Ui) *cmd {
c := &cmd{UI: ui}
c.initFlags()
c.init()
return c
}
@ -18,16 +18,18 @@ type cmd struct {
UI cli.Ui
flags *flag.FlagSet
http *flags.HTTPFlags
usage string
wan bool
}
func (c *cmd) initFlags() {
func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.flags.BoolVar(&c.wan, "wan", false,
"Joins a server to another server in the WAN pool.")
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 {
@ -73,10 +75,10 @@ func (c *cmd) Synopsis() string {
}
func (c *cmd) Help() string {
s := `Usage: consul join [options] address ...
return c.usage
}
const usage = `Usage: consul join [options] address ...
Tells a running Consul agent (with "consul agent") to join the cluster
by specifying at least one existing member.`
return flags.Usage(s, c.flags, c.http.ClientFlags(), nil)
}

Loading…
Cancel
Save