11 ms·
> inconsistent command line arguments: is it -h or help or –help? I've said it before and I'll say it again: the error "Option `--help` not understood, did you
by exmadscientist 2y ago
> inconsistent command line arguments: is it -h or help or –help?
I've said it before and I'll say it again: the error "Option `--help` not understood, did you mean `-help`? Use `-help` to display program options." is one of the most insulting things a program can say to me. `--help` is the lowest common denominator. You have to support it. I don't care what your program has to special case in its parsing, just do it. If I knew your program's preferred syntax, I wouldn't be asking it for help.
- xboxnolifes 2y ago--help isn't even the lowest common denominator. An incorrect argument list is. The program knows it was given incorrect arguments, it should show help.
- exmadscientist 2y agoMany programs prefer to be concise when their arguments are wrong, perhaps on the assumption that it's probably a simple typo rather than a request for screenfuls of help information. This sometimes is and sometimes isn't an ergonomic choice. (I usually prefer conciseness.) But asking for `--help` is unambiguous, and is in fact the lowest common denominator way to be explicit about it.
- dfox 2y ago-? should be lowest common denominator, because that is exactly equivalent to passing incorrect argument list when using getopt(). Whether that should produce concise help of the kind "usage: foo -abcdeEf <file>" or full help is another question.
- lloeki 2y ago`?` is a glob for one character so it would work only if you: a) use bash-like behaviour of an unmatched glob turning into a bare word, e.g with zsh have `setopt NULL_GLOB`. AND b) don't have a file named, say, `-a` in the current working directory. Try this: touch ./-l ls -? The common denominator for getting help would be man(1).
- maleldil 2y ago> The common denominator for getting help would be man(1). That's... not what a common denominator means. It's far easier to check for `--help` or `-h` and print _something_ than write a whole document in a weird markup language for man.
- lloeki 2y ago"common denominator" is the thing that is guaranteed common for all commands. man(1) is, provided that people produce man pages. It's also orthogonal and composable without interference: one can write a man page for commands that don't have man pages. Flags are not, because commands parse their arguments in whatever way; all commands can accept arguments but arguments are also part of the operational interface contract. man(1) is decoupling all possible problems out. It is also extremely obvious than `man foo` is side-effect free, whereas `foo whatever`, whether `whatever` can be `--help` or anything else, has unknown effects when the command is unknown. Some argue that man pages are too rich; well the man pages can just also start with a summary identical to what a hypothetical `--help` flag would output. Turns out this is the conventional `SYNOPSYS` title of section 1 man pages, and possibly the `OPTIONS` one; if these are absent or badly written then one could reasonably posit that a hypothetical `--help` flag output would be just as unhelpful; cue the wads of commands that "--helpfully" output `foo [-4236xXksirtTgsdv]` as help, which tells you nothing really helpful. `info(1)` can burn in hell though.
- maleldil 2y agoMy understanding is the opposite: man pages are much more difficult to produce than plain help text, so it's unreasonable to expect they'll always be available, while help is easy enough to (almost) always be there. If you use any CLI library at all, it will automatically be generated. If you don't, the equivalent of `argv[1] == "--help"` is good enough. These days, I'm positively surprised when I find man pages for a program, whereas I'm annoyed when one doesn't support --help.
- lloeki 2y ago
- linsomniac 2y agoVery few things grind my gears like having to search through a wall of "--help" output and lengthy list of arguments to find the error that describes the problem. Screenfulls of text when the error is "Option 'b' unknown" isn't helpful.
- AStonesThrow 2y agoOh it's worse than that. Some classes and even supervisors I've had, forced me to read documentation, over and above actually doing stuff
- Thorrez 2y agoIf you need to learn something (e.g. you're taking a class or your supervisor wants you to learn something), then reading the documentation is a good idea. If you already know the content, but accidentally made a typo and are trying to debug it, then reading the documentation isn't going to help. An error message pointing out the problem will help.
- linsomniac 2y agoI had a teacher like that in High School. "I made a mistake in this proof, but I'm not sure what it is." "You have the book for the course, the answer is in there."
- kevin_thibedeau 2y agoWould you expect a sports referee to manage a match without knowing the rules of the game?.
- AStonesThrow 2y agoNo but the sports referee perhaps specializes in one or a few games/leagues. And at high levels, a referee role is probably similar to physician/lawyer where you'll have annual rule updates/changes, jurisprudence history of past rulings, and conventions/associations of referees where they will be spending money, time and effort when not on the field. Now multiply the referee's game or league types by everything in /usr/bin
- GoblinSlayer 2y ago>--help isn't even the lowest common denominator. An incorrect argument list is. --help being an incorrect argument does the right thing, yes.
- crabbone 2y agoSometimes, arguably, you can do better. For instance, some CLI tools try to guess what the user was trying to accomplish, and show a more specialized message. Eg. kubectl will tell users that a particular kind of resource they were looking for doesn't exist, but there are some with similar names. This is especially useful in situations where the help text is enormous (dozens and dozens of options).
- pgwhalen 2y agoI agree with this, but would also point out that many junior engineers I've worked with completely give and ask for help if the program doesn't do what they want it to and prints out many lines of help. Even if there is a clear message at the top of the large output, they get overwhelmed.
- immibis 2y agoAn incorrect argument list should concisely tell me what is wrong with the argument list, and that I can use --help to explain the whole thing. I don't want to scroll up 20 pages to fix a typo - assuming the program even printed a specific error before it printed 20 pages of help.
- lucb1e 2y agoOh god please no, I hate the rare program that poops my terminal full of seven pages of output and I have to use like shift+pgup or the mouse to get back up to see the only four useful words of output: "option --anakyze not recognized". This also confuses the heck out of beginners. MariaDB also doesn't print the entire manual when it goes "syntax error at ' OR 1=1". It makes no sense. You can include "See --help for more information" at the end of every error to make sure everyone knows where to find that, though, since indeed not every program uses the same syntax for usage. 90% of the time I don't need a copy of a program's manual in my scrollback when I, say ,typo something or forgot that two options are incompatible. There is a reason scrollback exists and I use it for that purpose. I'll look up the manual or run --help in another terminal tab/window, or choose to run it in the current one at my own discretion thank you
- danudey 2y agoJust to throw this out there: let's also hate on programs that give you seven pages of output for --help but print it to stderr so you have to jump through shell redirection hoops to pipe it to a pager to be able to read or search through it.
- xp84 2y agoThis reminds me of something I remember having installed years ago that would format `man` pages as a nice document (using... grotty or something??) and open them in Preview or something. I think it was on a mac and it was 15+ years ago. Genuinely my least favorite thing in the terminal is when I forget some detail about... usually CURL, since they use the capitals AND the lowercase letter arguments for very different things. So I end up having to use the / command in `less` to search for some common word for 3-5 minutes because the manpage is so disorganized. We have a much better tool than the Terminal for viewing long-form text content, so maybe I just need to alias `man` to open a website that publishes manpages.
- Arnavion 2y ago`--help` is a GNU convention, which is why it's not as universal as you want it to be. Of course these days most Linux users interact with GNU tools and thus go on to develop their own tools with the same convention, but it's the reason why non-GNU things like BSD utils or old `openssl` don't have it.
- hylaride 2y agoThe GNU/BSD conventions are a lot of fun when you have some automation scripts that are used by people who are split between MacOS and Linux (or WSL on Windows).
- kps 2y ago`--long` options started with GNU (I think) but were soon adopted more widely. One of the really nice things about ksh that bash has neglected to copy is that its `getopts` easily handles long options and has built-in `--help`.
- jerf 2y agoIt's 2025, not 1995. I'm about as sympathetic to this as "POSIX doesn't have it." For something like this, I don't care. I don't care how it's done. Heck, dump the help if you see any option with two dashes, if you're offended about long options. I don't care what other things dump help out too as long as --help does. But both -h and --help should always produce help, no matter what, no matter where you are, and I'd really like -help too, even if that is a bit more complicated. Though since I also want "a -h or a --help in the parameter list reliably makes it so that help is printed and NOTHING ELSE happens", "-help" should generally work as "-h" and "extra stuff that won't happen because -h is in play". It is an error for a program to both print the help and take any other action; should always do one XOR the other.
- benatkin 2y agoWhat about programs with such simple CLIs that they don’t have help? How about non English speakers who might be inclined to type —ayuda or something? In 2025 I think it should be more obvious that the shell is just running a program and programs have a variety of entry points and the same program can be distributed in different forms and that they might not all be self documenting.
- bouke 2y agoOr database clients (e.g. psql) using `-h` for the host argument. I get it, but I don't like it.
- viraptor 2y ago-H is right there and available. But they chose to be slightly weird...
- kccqzy 2y agoOn macOS the shutdown command uses `-h` to mean halt, i.e. an actual shutdown.
- daleswanson 2y agoThat's how shutdown works on Linux too.
- swiftcoder 2y agoThe fact that they already special-cased the parser to let you know that you used the wrong help option, but didn't just forward to the right one, is just incredibly pedantic
- ithkuil 2y agoIt's probably fuzzy similarity search
- TeMPOraL 2y agoIf you can bother writing a fuzzy similarity search, you can just short-circuit it on "--help". Most software I see with such problems do neither.
- ithkuil 2y agoI think the idea is that fuzzy search makes it easier for users to spot typos and this is a general feature of the flag library not something specific for --help. Short-circuit any typo may be dangerous. Now, an argument can be made for including as many aliases for "help" and "version" as possible but that's a different story
- pgwhalen 2y agoYou can of course - I think the point here is it's different people with different goals writing the CLI lib vs the application. So it's often not the case that a single person who made the decision to have a message that says "you asked for help, but you did it wrong; before I give you help you have to ask correctly."
- swiftcoder 2y ago"this dependency I picked at random from CPAN doesn't support that" is a pretty weak excuse for shipping a poor user experience
- WD-42 2y ago
- ljm 2y agoAlso, single dash for long args and not just short args. I think mostly Go tools do this, and whatever purism is used to justify the choice, I can't think of many CLI apps that don't use a single dash for short args (and combining a sequence of flags) and a double dash for long ones.
- oxidant 2y ago`find` comes to mind. I consistently need to look up the syntax.
- idunnoman1222 2y agoUse fd instead
- danudey 2y agoIn case people were curious: https://github.com/sharkdp/fd https://github.com/sharkdp/fd
- Daneel_ 2y agoIf it’s not installed by default on server-oriented flavours of Linux then it’s dead to me, unfortunately. Most orgs aren’t going to agree to roll it out across tens of thousands of machines on a whim. My entire Linux experience is dictated by what’s installed by default on rhel and/or ubuntu.
- jsperson 2y agoThis is why I originally learned vi. Working on DoD machines as well as this of other consulting customers. I had a notebook of short scripts and commands that would make my life easier. I couldn't use any media or even reference the internet in many of the data centers and labs.
- dsr_ 2y ago"installed by default" should never be a compelling consideration for an org with ten thousand machines, or one hundred. As soon as they have their own package repos and automatic deploy systems, it should be as simple as saying "fd is a fast file finding utility packaged upstream as 'fd-find'. Please add it to the deploy list for these classes of machines" or whatever else starts your change management system grinding.
- scbrg 2y agoI find it helpful. If it's a program that generally supports single dash options only, having it respond to --help will falsely make me believe that it's one that expects double dash options. Letting me know that the proper way to ask for help is `-help` also communicates that GNU style double dash long opts is not the way to go with this particular program. Then I suppose you could argue that GNU style double dash options should be supported. Meh, I dunno. They were the ones that invented the fifteenth standard (xkcd/927).
- exmadscientist 2y agoI mean, it's perfectly fine if the way `--help` communicates that you shouldn't be using double-dash options is by... giving the help text that has all single dash options. That seems like pretty solid communication? I don't care at all which type the program likes. I just can't remember which programs like which styles. So I ask them. And I prefer if they don't insult me when I do.
- scbrg 2y agoHeh. Fair enough :-) I just don't really see how that one, single, extra three second step is much to get upset about, and I think it's just welcome that it rubs me in the face that I got it wrong. It makes me not gloss over the help text and start double dashing my way into the next to command. But sure, I see your point. I just wished K&R had had the forethought to establish a proper standard. I don't particularly care what it would have been.
- scbrg 2y agoAnd... before anybody points it out: When I wrote K&R, I obviously had a brain fart. I was thinking about Ken Thompson and Dennis Ritchie, but the acronym is of course normally used to refer to Brian Kernighan and Dennis. Sorry for any confusion :)
- blueflow 2y agoIts not "$command --help", its "man 1 $command". You should not invoke programs blindly, hoping "--help" causes them to do nothing else.
- tenacious_tuna 2y agothis works great on systems where programs are largely installed via package manager, but in plenty of environments is an unreasonable expectation. There's many many times I've gotten "no manual entry for $program" but there's extensive online help available in the program itself. Expecting there to be a safe invokation for "how do I use this damn thing" is 100% fair.
- blueflow 2y ago> Expecting there to be a safe invokation for "how do I use this damn thing" is 100% fair. Are you on debian? Do an `/usr/sbin/e2scrub_all --help`.
- danudey 2y agoOkay. $ e2scrub_all --help e2scrub_all must be run as root $ sudo e2scrub_all --help [sudo] password for dan: /usr/sbin/e2scrub_all: illegal option -- - Usage: /usr/sbin/e2scrub_all [OPTIONS] -n: Show what commands e2scrub_all would execute. -r: Remove e2scrub snapshots. -A: Scrub all ext[234] filesystems even if not mounted. -V: Print version information and exit. (Checking for being root before checking for --help is also frustrating)
- blueflow 2y ago`man e2scrub_all` works without root :P
- tenacious_tuna 2y agoAnsible's recommended install path is as a python pip package, which doesn't add manual pages. It's expected that to access the online documentation for ansible you fire off a ton of `ansible help topic` commands. `ipa`, the active-directory adjacent system published by IBM, also expects you to make heavy use of the `--help topic` pattern. When manual pages exist they're wonderful and lovely. It's a good standard, and my favorite is when the online help system of a given script or installed package (e.g. via pip) emulates man--but there aren't always man pages that's the entire point of my complaint here. It's unreliable in many contexts, but you do always have access to the command itself.
- f1shy 2y agoAmen! Some programs give a short help message when options are not understood. A good thing. That said, in GNU/Linux a program that does not have --help is shitware.
- WD-42 2y agoAgreed, but to be fair some of that comes from fuzzy searching the available parameters for close matches. Which is normally helpful.
- nurumaik 2y agoJust print help instead of any error during parsing
- chasil 2y agoPOSIX doesn't have any of that. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/ https://pubs.opengroup.org/onlinepubs/9799919799/utilities/ "I got used to fish and vi mode which are not available when I ssh into servers, containers." POSIX does mention vi mode as an optional feature. "Allow shell command line editing using the built-in vi editor. Enabling vi mode shall disable any other command line editing mode provided as an implementation extension. This option shall be supported if the system supports the User Portability Utilities option."
- blueflow 2y agoAnd POSIX has man(1) instead of --help: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m...
- danudey 2y agoDon't forget when a program only accepts short-form arguments: `cmd --help` Error: option - not understood. Use `cmd -h` for help. Or this pattern that we find everywhere in golang-written tools: $ helm --version Error: unknown flag: --version $ helm version version.BuildInfo{Version:"v3.17.0", GitCommit:"301108edc7ac2a8ba79e4ebf5701b0b6ce6a31e4", GitTreeState:"clean", GoVersion:"go1.23.4"} (The reason for this one seems to be that, in your CLI-parsing library, you have verbs that define what you want and flags that pass options to those verbs; 'show me the version' is a verb, so it can't be a flag instead. Without a verb, the program doesn't know what to do. It's still infuriating, though, but at least it reduces the frequency with which -- is substituted for an em-dash (e.g. when sending commands to coworkers from your iPhone via Slack).