diff --git a/api/api.go b/api/api.go index 5ac7225981..ee7cecfeba 100644 --- a/api/api.go +++ b/api/api.go @@ -451,7 +451,7 @@ func (r *request) setWriteOptions(q *WriteOptions) { r.header.Set("X-Consul-Token", q.Token) } if q.RelayFactor != 0 { - r.header.Set("relay-factor", strconv.Itoa(int(q.RelayFactor))) + r.params.Set("relay-factor", strconv.Itoa(int(q.RelayFactor))) } } diff --git a/command/base/command.go b/command/base/command.go index 2741ea2cba..1710e20598 100644 --- a/command/base/command.go +++ b/command/base/command.go @@ -75,7 +75,7 @@ func (c *Command) httpFlagsClient(f *flag.FlagSet) *flag.FlagSet { } f.Var(&c.httpAddr, "http-addr", - "Address and port to the Consul HTTP agent. The value can be an IP "+ + "The `address` and port of the Consul HTTP agent. The value can be an IP "+ "address or DNS address, but it must also include the port. This can "+ "also be specified via the CONSUL_HTTP_ADDR environment variable. The "+ "default value is 127.0.0.1:8500.") @@ -140,6 +140,8 @@ func (c *Command) Parse(args []string) error { // Help returns the help for this flagSet. func (c *Command) Help() string { + // Some commands with subcommands (kv/snapshot) call this without initializing + // any flags first, so exit early to avoid a panic if c.flagSet == nil { return "" } @@ -211,10 +213,6 @@ func printTitle(w io.Writer, s string) { func printFlag(w io.Writer, f *flag.Flag) { example, _ := flag.UnquoteUsage(f) if example != "" { - // Change 'value' to 'string' for consistency - if example == "value" { - example = "string" - } fmt.Fprintf(w, " -%s=<%s>\n", f.Name, example) } else { fmt.Fprintf(w, " -%s\n", f.Name) diff --git a/command/event.go b/command/event.go index 75b7733557..4f5493d0c7 100644 --- a/command/event.go +++ b/command/event.go @@ -37,7 +37,7 @@ func (c *EventCommand) Run(args []string) int { f.StringVar(&node, "node", "", "Regular expression to filter on node names.") f.StringVar(&service, "service", "", - "Regular expression to filter on service instances") + "Regular expression to filter on service instances.") f.StringVar(&tag, "tag", "", "Regular expression to filter on service tags. Must be used with -service.") diff --git a/command/keyring.go b/command/keyring.go index fd1ea16451..31ae284e15 100644 --- a/command/keyring.go +++ b/command/keyring.go @@ -36,9 +36,9 @@ func (c *KeyringCommand) Run(args []string) int { f.BoolVar(&listKeys, "list", false, "List all keys currently in use within the cluster.") f.IntVar(&relay, "relay-factor", 0, - "Added in Consul 0.7.4, setting this to a non-zero value will cause nodes "+ - "to relay their response to the operation through this many randomly-chosen "+ - "other nodes in the cluster. The maximum allowed value is 5.") + "Setting this to a non-zero value will cause nodes to relay their response "+ + "to the operation through this many randomly-chosen other nodes in the "+ + "cluster. The maximum allowed value is 5.") if err := c.Command.Parse(args); err != nil { return 1 diff --git a/command/kv_get.go b/command/kv_get.go index dc509b243f..94a23bacde 100644 --- a/command/kv_get.go +++ b/command/kv_get.go @@ -57,6 +57,8 @@ Usage: consul kv get [options] [KEY_OR_PREFIX] func (c *KVGetCommand) Run(args []string) int { f := c.Command.NewFlagSet(c) + base64encode := f.Bool("base64", false, + "Base64 encode the value. The default value is false.") detailed := f.Bool("detailed", false, "Provide additional metadata about the key in addition to the value such "+ "as the ModifyIndex and any flags that may have been set on the key. "+ @@ -66,8 +68,6 @@ func (c *KVGetCommand) Run(args []string) int { "This is especially useful if you only need the key names themselves. "+ "This option is commonly combined with the -separator option. The default "+ "value is false.") - base64encode := f.Bool("base64", false, - "Base64 encode the value. The default value is false.") recurse := f.Bool("recurse", false, "Recursively look at all keys prefixed with the given path. The default "+ "value is false.") diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 60300df626..c2c385eaa9 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -88,8 +88,8 @@