coreos / docs

Documentation for CoreOS projects
http://coreos.com/docs
Apache License 2.0
882 stars 532 forks source link

Options in docs and Usage should follow hyphen convention: -s, --long #650

Open joshix opened 8 years ago

joshix commented 8 years ago

Make Docs (including Usage output from commands) across projects eventually consistent on single hyphen for single-character options (-o) and double hyphen for long options (--option).

(After https://github.com/spf13/cobra options munging lib.)

(Ideally, programs continue to be generous in accepting either form (-flag or --flag)

prog -f --option argument

(preserving TODO from discussion on https://github.com/coreos-inc/coreos-pages/pull/346)

jonboulle commented 8 years ago

We should rather standardise on double-dash. Go's default flag parsing is a bit of an oddity and the CLI package that we are attempting to standardise on only supports double dashes for long args:

; rkt  -debug list
NAME:
    list - List pods

USAGE:
    rkt list

OPTIONS:
      --full[=false]        use long output format
  -h, --help[=false]        help for list
      --no-legend[=false]   suppress a legend with the list

GLOBAL OPTIONS:
      --debug[=false]           print out more debug information to stderr
      --dir=/var/lib/rkt        rkt data directory
      --insecure-skip-verify[=false]    skip all TLS, image or fingerprint verification
      --local-config=/etc/rkt       local configuration directory
      --system-config=/usr/lib/rkt  system configuration directory
      --trust-keys-from-https[=true]    automatically trust gpg keys fetched from https

Error: unknown shorthand flag: 'd' in -debug
Run 'rkt help' for usage.

; rkt  --debug list
UUID    APP IMAGE NAME  STATE   NETWORKS
jonboulle commented 8 years ago

er, I might be lying about that being spf13/cobra's strict behaviour but we decided to take that approach in rkt to avoid ambiguity. https://github.com/coreos/rkt/pull/1028#issuecomment-111614038

joshix commented 8 years ago

Good reasons. I'm convinced. Important theme of this issue is to standardize it in the docs and Usage prints. So let's say the standard is: Short option single hyphen: -o, long option double: --option.

jonboulle commented 8 years ago

SGTM