I tend to go by the paradigm of single dash for single character options, and double dash for full words (and common things like —-help should have aliases like -h).
I tend to go by the paradigm of single dash for single character options, and double dash for full words (and common things like —-help should have aliases like -h).
I've always wondered why the style of command flags wasn't "more" standardized after 32 years of Linux being around (not that thats the first time flags were introduced, just an easy stop so I don't have to dig into that since it's not super relevant).
So, maybe it is somewhat/completely standardized and I'm just not aware of where that information is?
I think your style would still frustrate me. I'd first type "executable -help" thinking that was probably the - and -- option, and get a command not found error. I wouldn't think that think we're using - and -- differently.
> An option and its argument may or may not appear as separate tokens. (In other words, the whitespace separating them is optional.) Thus, -o foo and -ofoo are equivalent.
Thanks this is super helpful I never knew this was a GNU thing.
More specifically, getopt(3) in POSIX lets programmers very this by giving a format string. "o:f" would make your example parse as "-o" "foo" while "of:" would make it parse as "-o" "-f" "oo" and an "of" format would make it parse as you describe, "-o" "-f" "-o" "-o".
( darnir mentioned parts of this above: https://news.ycombinator.com/item?id=38968612 using the term "single character flags" to indicate no argument. )
Also, while --long-option is GNU, gcc which is perhaps the aboriginal GNU command-line utility uses single dash as in, e.g. `gcc -pipe`, though it also accepts `gcc --help`. CL syntax remains quite varied in the wild.
My pet peeve is commands not supporting -h for help and making me write --help. This is especially worse when the command already supports single character arguments.