Cleanup and formatting adjustments

This commit is contained in:
Kyle Havlovitz 2017-02-09 20:49:17 -05:00
parent 2a82804c0c
commit a64c5e69a3
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
6 changed files with 12 additions and 14 deletions

View File

@ -451,7 +451,7 @@ func (r *request) setWriteOptions(q *WriteOptions) {
r.header.Set("X-Consul-Token", q.Token) r.header.Set("X-Consul-Token", q.Token)
} }
if q.RelayFactor != 0 { if q.RelayFactor != 0 {
r.header.Set("relay-factor", strconv.Itoa(int(q.RelayFactor))) r.params.Set("relay-factor", strconv.Itoa(int(q.RelayFactor)))
} }
} }

View File

@ -75,7 +75,7 @@ func (c *Command) httpFlagsClient(f *flag.FlagSet) *flag.FlagSet {
} }
f.Var(&c.httpAddr, "http-addr", 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 "+ "address or DNS address, but it must also include the port. This can "+
"also be specified via the CONSUL_HTTP_ADDR environment variable. The "+ "also be specified via the CONSUL_HTTP_ADDR environment variable. The "+
"default value is 127.0.0.1:8500.") "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. // Help returns the help for this flagSet.
func (c *Command) Help() string { 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 { if c.flagSet == nil {
return "" return ""
} }
@ -211,10 +213,6 @@ func printTitle(w io.Writer, s string) {
func printFlag(w io.Writer, f *flag.Flag) { func printFlag(w io.Writer, f *flag.Flag) {
example, _ := flag.UnquoteUsage(f) example, _ := flag.UnquoteUsage(f)
if example != "" { if example != "" {
// Change 'value' to 'string' for consistency
if example == "value" {
example = "string"
}
fmt.Fprintf(w, " -%s=<%s>\n", f.Name, example) fmt.Fprintf(w, " -%s=<%s>\n", f.Name, example)
} else { } else {
fmt.Fprintf(w, " -%s\n", f.Name) fmt.Fprintf(w, " -%s\n", f.Name)

View File

@ -37,7 +37,7 @@ func (c *EventCommand) Run(args []string) int {
f.StringVar(&node, "node", "", f.StringVar(&node, "node", "",
"Regular expression to filter on node names.") "Regular expression to filter on node names.")
f.StringVar(&service, "service", "", f.StringVar(&service, "service", "",
"Regular expression to filter on service instances") "Regular expression to filter on service instances.")
f.StringVar(&tag, "tag", "", f.StringVar(&tag, "tag", "",
"Regular expression to filter on service tags. Must be used with -service.") "Regular expression to filter on service tags. Must be used with -service.")

View File

@ -36,9 +36,9 @@ func (c *KeyringCommand) Run(args []string) int {
f.BoolVar(&listKeys, "list", false, f.BoolVar(&listKeys, "list", false,
"List all keys currently in use within the cluster.") "List all keys currently in use within the cluster.")
f.IntVar(&relay, "relay-factor", 0, f.IntVar(&relay, "relay-factor", 0,
"Added in Consul 0.7.4, setting this to a non-zero value will cause nodes "+ "Setting this to a non-zero value will cause nodes to relay their response "+
"to relay their response to the operation through this many randomly-chosen "+ "to the operation through this many randomly-chosen other nodes in the "+
"other nodes in the cluster. The maximum allowed value is 5.") "cluster. The maximum allowed value is 5.")
if err := c.Command.Parse(args); err != nil { if err := c.Command.Parse(args); err != nil {
return 1 return 1

View File

@ -57,6 +57,8 @@ Usage: consul kv get [options] [KEY_OR_PREFIX]
func (c *KVGetCommand) Run(args []string) int { func (c *KVGetCommand) Run(args []string) int {
f := c.Command.NewFlagSet(c) f := c.Command.NewFlagSet(c)
base64encode := f.Bool("base64", false,
"Base64 encode the value. The default value is false.")
detailed := f.Bool("detailed", false, detailed := f.Bool("detailed", false,
"Provide additional metadata about the key in addition to the value such "+ "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. "+ "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 is especially useful if you only need the key names themselves. "+
"This option is commonly combined with the -separator option. The default "+ "This option is commonly combined with the -separator option. The default "+
"value is false.") "value is false.")
base64encode := f.Bool("base64", false,
"Base64 encode the value. The default value is false.")
recurse := f.Bool("recurse", false, recurse := f.Bool("recurse", false,
"Recursively look at all keys prefixed with the given path. The default "+ "Recursively look at all keys prefixed with the given path. The default "+
"value is false.") "value is false.")

View File

@ -88,8 +88,8 @@
</li> </li>
<li<%= sidebar_current("docs-commands-info") %>> <li<%= sidebar_current("docs-commands-info") %>>
<a href="/docs/commands/info.html">info</a> <a href="/docs/commands/info.html">info</a>
</li> </li>
<li<%= sidebar_current("docs-commands-join") %>> <li<%= sidebar_current("docs-commands-join") %>>
<a href="/docs/commands/join.html">join</a> <a href="/docs/commands/join.html">join</a>