== DRAFT ==
Although there’s no need for a standard usage of the getopt() long options, we have only 2 x 26 = 52 available switch characters for the older short options. (Actually, more, ‘cuz we can do things like -4 or -# or -@ for switches. Regardless…)
Because choices are limited, a defacto standard has emerged — 30+ years in the making — for the short options:
-f --force, sometimes -f is used for a config file
-h --help
-o --output (to the named file, for example) (rarely: -o optionname=value)
-v --verbose
-q --quiet
The above are almost universally used, while the following are “frequently” used:
-a --all or --append; or a start time (the --at-time)
-c --configuration-file or related .conf option, sometimes -f is used for this (but -c preferred)
-d --debug or sometimes --directory
-D --no-daemonize or --disable
-e --error; send to stderr instead of syslog
-E --enable
-g --group(s)
-i --interactive, --identity or some identity related thing, sometimes --ignore
-l --long or --lengthy, such as include details (different than verbose); or --log-level, or --list
-n --count, any numerical thing
-p --port or --priority
-r --recursive
-R --alternate-root or --root, also -R (uppercase) sometimes used for --recursive
-t time-related things
-T test related things, especially test timeouts
-u --user or username or submitter things, sometimes -l used for this (think l = login name)
-V --version (uses uppercase V because lowercase v means verbose)
-w a web-related thing, such as a URL
-x and -X X11 things. Historically, the upper/lowercase meaning is reversed;
lower is disable and upper is enable it -- this is opposite normal convention.
-y --yes, take the affirmative or default action instead of prompting; also -y used to mean syslog
-z --colorize-output
-4 IPv4
-6 IPv6
-# Any numerical limit (avoid this tho, it causes problems in shell scripts)
And a defacto convention is that the lowercase form is used to invoke an action, while the uppercase form is used to suppress an action. For example,
-z (lowercase) typically means to colorize the output
-Z (uppercase) means to NOT colorize the output, implying it's colorized by default.
But uppercase can also have conventional meanings, too. Such as -R for an alternate root.
—
These aren’t absolute, and there’s plenty of commands that don’t follow the above, but there’s more that do. If you’re writing a new utility or command, please try to follow the above! The community will thank you!