cli: Slice Flags help output is unexpected/confusing

Using a flag such as

cli.StringSliceFlag{"lang", &cli.StringSlice{"english", "spanish"}, "language for the greeting"},

results in help output like this:

OPTIONS:
   --lang [english spanish] `-lang option -lang option` language for the greeting

What exactly is the intended meaning of “-lang option -lang option”? Am I just uninformed or is this a WIP? I’d be happy to work on it if I know what it’s supposed to do! 😃

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

I also ran into this using etcdctl. Check this out:

–peers, C [] -peers, C option -peers, C option a comma-delimited list of machine addresses in the cluster (default: {“127.0.0.1:4001”})

But actually doing something like -peers 127.0.0.1,127.0.0.2 doesn’t work. What does work is specifying it multiple times like peers 127.0.0.1 -peers 127.0.0.2.

If you use an example like this one

cli.StringSliceFlag{
    "dns", 
    &cli.StringSlice{"8.8.8.8", "8.8.4.4"}, //here we are setting some predefined  values
    "set one or more dns Servers"
},

help output

OPTIONS:
   --dns [8.8.8.8  4.4.4.4] `-dns option -dns option` set one or more dns Servers

does it make sense now?