exmadscientist
12 days 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.
ljm
11 days ago
Also, 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.
kevin_thibedeau
11 days ago
Double dash for long args is a GNUism. One which even they don't adhere to uniformly as evidenced by GCC's options.
camel-cdr
11 days ago
It is, but combining a sequence of flags is POSIX.
codesnik
11 days ago
it's a simple to learn gnuism that most good tools follow but (mostly) java apps for whatever reason disrupted it and added a lot of mess.
layer8
11 days ago
The Java tools predate the GNU convention (or at best were developed at the same time, unbeknownst to each other). Golang uses single-dash as well (but also accepts double-dash), as do PowerShell and Unix commands like find. In early Unix, there wasn’t a clear convention to use a dash for options at all (dd, tar, ps).
kevin_thibedeau
11 days ago
GNU was established 10 years before Java.
layer8
11 days ago
GNU double-dash long options were devised only after POSIX disallowed using the plus sign in 1992: https://blog.djmnet.org/2019/08/02/why-do-long-options-start...
Java was already two years in development at that time.
oxidant
11 days ago
`find` comes to mind. I consistently need to look up the syntax.
idunnoman1222
11 days ago
Use fd instead
Daneel_
11 days ago
If 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
11 days ago
This 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_
11 days 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.
Daneel_
11 days ago
Unfortunately that doesn't cut the mustard in most organisations either, with the typical responses being along the lines of: "Who will support it? Can you provide a security assessment? Is your team happy to be responsible for any issues?"
I sorely wish it was as simple as "please deploy", and in days of yesteryear you could probably get away with that either yourself or if you were friends with the linux team, but those days are over now as far as I see.
For context, my opinion comes from being a security consultant for over a decade - I see a lot of other people's environments and how their organisations handle requests like this. Not every environment will have objections, but most won't add it as a standard package across the fleet.
dsr_
7 days ago
My opinion comes from decades of running the department that provides an initial security assessment and then signs up to support it.
danudey
11 days ago
In case people were curious: https://github.com/sharkdp/fd
oxidant
10 days ago
Wonderful, thank you. I've already cut my typing in half with rg, I'm ready to commit to another 50%
danudey
11 days ago
It's most common in Go's own tooling (e.g. `go build -buildmode`) but is also present in older tooling like e.g. GNU findutils (e.g. `find . -name something`).
The go tooling also has the irritating tendency to take a command like `go build --help` and say "oh, run `go help build` for details" instead of just printing out a list of possible options. Also: the details page doesn't always present you with a list of possible options, so you have to read each paragraph to see if there's an option relevant to your interests.
tdeck
11 days ago
A lot of Java tools do this for some reason and I hate it.
plagiarist
11 days ago
This sets me off. Whenever I have any viable alternative to a single dash long arg tool I take the alternative.
somat
11 days ago
Personally, I dislike gnu style double dash and actively despise the double dash equals variant( --arg=value ). I just think it adds a lot of unnecessary noise to the command line.
And after a bit of shower thinking, you know that alone time with nothing better to do but ponder the mysteries of the universe, things like black holes, the nature of light and the ascetic of the command line. I decided that single dashes were also sort of ugly and hindered readability, but there was a better way as hinted by the single most screwball command in the standard unix installation.
Yes it is I ( evil laugh ), that misanthrope actively making new cli scripts what use dd style arg=value
http://nl1.outband.net/extra/remv.txt
Actually the real epiphany was when I was doing some work with "megacli" the tool for lsi hardware raid management. I noticed that sometimes I could forget to add a dash to an argument. A little experimentation showed that no arg actually required a dash and the capitalization was ignored. it was like a huge weight was lifted from my shoulders, much better this way.
MegaCli -PdReplaceMissing -PhysDrv [1:1] -Array2 -row1 -a1
MegaCli pdreplacemissing physdrv [1:1] array2 row1 a1
schoen
11 days ago
danudey
11 days ago
Does MegaCli still ship with its own copy of libc5 because it's so old and disgusting that they can't bring themselves to upgrade it? Or did they figure out how to resolve that eventually?
somat
11 days ago
No idea. megacli was always a weird program you had to sort sneak on the server however you could fit it. it got renamed to cmdtool at some point(I think because intel were shipping lsi cards). Honestly I am fairly happy we no longer use hardware raid here. Too many mysteries.
swiftcoder
11 days ago
The 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
toast0
11 days ago
Likely they print that message for any unknown argument.
ithkuil
11 days ago
It's probably fuzzy similarity search
TeMPOraL
11 days ago
If 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
11 days ago
I 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
11 days ago
You 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
11 days 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
11 days ago
I don’t think people bother to write them, more likely it’s built in to whatever cli lib they happen to be using and they enable it.
AStonesThrow
11 days ago
sorry, you've typed "[em][en]h[Cyrillic]lp", try again
idle_zealot
11 days ago
Is it? It is helping you. Your first tip: here's what the argument syntax looks like, use it.
swiftcoder
11 days ago
It's "helping" in an incredibly pedantic and unhelpful way. The developer has opted to add explicit support for the common option, but only as a means to tell the user that they are "holding it wrong" (in the immortal words of Apple)
danudey
11 days ago
When I was a kid, I was playing Beyond Zork, and one night when I was very tired I came across a pterodactyl. Unfortunately, I kept making typos.
>> aim wand at perodactyl
> I see no perodactyl here.
>> aim wand at pterodacyl
> I see no pterodacyl here.
Frustrated at my continuing mistakes, I decided to try to short-circuit their logic. Despite knowing the difference, I typed this:
> aim wand at bird
And the game replied:
> a pterodactyl is not a bird
Arnavion
11 days 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.
jerf
11 days ago
It'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.
Arnavion
11 days ago
To be clear, the point of my comment was to give the reason that `--help` isn't universal, not to present any opinion on whether it should or should not be. (I myself am in the "go on to develop their own tools with the same convention" camp.)
benatkin
11 days ago
What 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.
f1shy
11 days ago
Personal opinion ahead, please don’t be offended:
> What about programs with such simple CLIs that they don’t have help?
It is crapware
> about non English speakers who might be inclined to type —ayuda or something?
Come on… really?! Most utilities use heavily english for option names. Even the names of the utilities. Should we have “buscar” instead of “find”, or “schneiden” for “cut”? What about iger instead of “grep”?
That is just ridiculous! Please stop!
Y_Y
11 days ago
I'm interested in how you've translated "grep".
I would guess you chose something like mapping "Global Regular Expression Print" to "Imprimir Globalmente Expresión Regular". But of course "grep" isn't really an acronym, but a contraction of the ed (and ex) command "g/re/p". Surely you don't mean to alter the syntax along with the words!
f1shy
11 days ago
Interprete gobal de expresiones regulares, as to my Knowledge grep stand for global reg ex parser.
My Knowledge come from some archaic Sun manual. I wanted to find it, and everywhere it says print… I had it wrong.
Anyway the idea is to show that translating is always partial, ans a full translation would be a titanic and unproductive work.
I’m a native speaker of a couple of languages, and learned some more. So i have used computers in many languages. I hate command line translations, all are bad.
benatkin
11 days ago
I'm not offended hehe. I like small processes, and am into language learning, so my bias is showing. I think how things are, with most supporting --help, but not all, makes sense.
I think what some are going for perhaps is that all programs to be run in the shell support --help. I think it could be normalized further by having a shell function get help for a command. For most it could pass --help, but it could handle the exceptions. So instead of running "foo --help" you could run "help foo", and it would run "foo --help" or "foo -h" or whatever, and it would be like man except instead of meaning show a manual page it could mean ask a program to document itself.
Arnavion
11 days ago
>I think it could be normalized further by having a shell function get help for a command.
See PowerShell commandlets for a related precedent: https://learn.microsoft.com/en-us/powershell/scripting/devel... Commandlets (shell functions) can annotate themselves and their parameters in a standard way, and then the shell's builtin help command parses that and presents it in a standard way. Though unfortunately this kind of integration only works for the commandlets, not arbitrary executables, because there's no standard for executables to expose such metadata to the shell.
kps
11 days 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`.
hylaride
11 days ago
The 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).
f1shy
11 days ago
If I’m working in Ubuntu, a GNU/Linux system, I expect to be pretty universal.
I’m BSD and Solaris guy, but when I’m in linux, I spect linux. It should be part of PORTING a program, if the option is not supported.
xboxnolifes
11 days 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.
lucb1e
11 days ago
Oh 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
11 days ago
Just 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
11 days ago
This 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.
exmadscientist
11 days ago
Many 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.
linsomniac
11 days ago
Very 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.
gknoy
11 days ago
This seems like it would be solved completely by printing the error message ("option b unknown"), and then also printing the "--help" stuff. You can see the error inthe first line(s), so `head` will make that easy to see, but anyone trying to print the help text will get it.
linsomniac
11 days ago
Yeah, except both the error and the --help are going to stderr. ;-)
AStonesThrow
11 days ago
Oh 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
11 days ago
If 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
11 days ago
I 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."
sbuk
11 days ago
Reading techical documentation is a skill. It's one that is sorely lacking in IT from develpers to ops. RTFM when learning is a valid lesson in and of itself.
kevin_thibedeau
11 days ago
Would you expect a sports referee to manage a match without knowing the rules of the game?.
AStonesThrow
8 days ago
No 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
gerad
11 days ago
lol how the sarcasm was lost on hackernews
dfox
11 days 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
11 days 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).TeMPOraL
11 days ago
> b) don't have a file named, say, `-a` in the current working directory.
Rather:
b) don't have a file with a single letter name in your CWD, like `a`
Try this:
touch a
ls -?
And yes, it's even more damning; you don't generally find legitimate files named `-a` or similar - rather, it's clear indication of someone invoking some CLI command wrong (`cp` comes to mind). However, single-letter files and folders are a relatively frequent thing to see.me-vs-cat
11 days ago
> Try this: touch a; ls -?
I don't see it. What are you trying to show with 'a' instead of '-l'? Why would a file named 'a' interact with a glob like '-?'?
$ touch a
$ ls -?
zsh: no matches found: -?
$ bash -c 'ls -?'
ls: invalid option -- '?'
Try 'ls --help' for more information.
$ dash -c 'ls -?'
ls: invalid option -- '?'
Try 'ls --help' for more information.
$ touch ./-l
$ ls -?
.rw-rw-r-- 0 user 10 Feb 18:32 -l
.rw-rw-r-- 0 user 10 Feb 18:31 a
TeMPOraL
10 days ago
ZSH must handle globs in some weird way?
'?' is glob for one character, '-?' means "dash followed by any character", and that's what I'd expect to be matched, and that's what my `ls` does.
me-vs-cat
10 days ago
I have a non-default option on for zsh, which is incredibly useful interactively. (Bash also has this option, but I haven't enabled it.)
Normally, ls doesn't expand globs.
Why did you say to try "touch a; ls -?"? What am I supposed to see from those two commands?
lloeki
10 days ago
> '-?' means "dash followed by any character"
but `a` is not "dash followed by one character" so the glob does not match a `a` file?
my haha nearby was wrong! I should have tested it :)
lloeki
11 days ago
Haha true, I missed the most obvious of all!
maleldil
11 days 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
11 days 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
11 days ago
My 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
11 days ago
> man pages are much more difficult to produce than plain help text
They're absolutely trivial to generate these days, gone are the days of having to deal with roff, you can write a quite dumb markdown file and produce a man page out of it in short order.
https://github.com/sunaku/md2man/blob/master/EXAMPLE.markdow...
https://github.com/rtomayko/ronn/blob/master/man/ronn-format...
maleldil
10 days ago
I'm not necessarily saying they're _difficult_, but it should be obvious they're relatively harder. For --help, the least I could do would be a conditional at the top of the program, or let my CLI library auto-generate it for me. For man pages, I have to go out of my way to explicitly generate and distribute them.
TeMPOraL
11 days ago
> Some argue that man pages are too rich
There are people arguing that? My feeling is that man pages are usually so thin as to be useless in 50%+ scenarios I need them. I really wished the culture defaulted to expecting all software to come with Info pages.
immibis
11 days ago
An 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.
crabbone
11 days ago
Sometimes, 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
11 days ago
I 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.
GoblinSlayer
11 days ago
>--help isn't even the lowest common denominator. An incorrect argument list is.
--help being an incorrect argument does the right thing, yes.
f1shy
11 days ago
Amen!
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.
danudey
11 days ago
Don'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).
bouke
11 days ago
Or database clients (e.g. psql) using `-h` for the host argument. I get it, but I don't like it.
viraptor
11 days ago
-H is right there and available. But they chose to be slightly weird...
kccqzy
11 days ago
On macOS the shutdown command uses `-h` to mean halt, i.e. an actual shutdown.
daleswanson
10 days ago
That's how shutdown works on Linux too.
chasil
11 days ago
POSIX doesn't have any of that.
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
11 days ago
And POSIX has man(1) instead of --help: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m...
WD-42
11 days ago
Agreed, but to be fair some of that comes from fuzzy searching the available parameters for close matches. Which is normally helpful.
blueflow
11 days ago
Its not "$command --help", its "man 1 $command". You should not invoke programs blindly, hoping "--help" causes them to do nothing else.
scubbo
11 days ago
I genuinely can't tell if this is a joke or not. I've only _once_ in my life encountered a tool that didn't have `--help` support (and that was a script written by the worst coworker I've ever suffered), but plenty of times I've encountered tools that have no manpage entries.
enriquto
11 days ago
> I've only _once_ in my life encountered a tool that didn't have `--help` support
Never heard of echo? What do you expect this to do?
echo --help
jancsika
11 days ago
display the help message and exit
blueflow
11 days ago
$ echo --help
--help
$ type echo
echo is a shell builtin
ninalanyon
10 days ago
I expect /usr/bin/echo to respond like this:
Usage: /usr/bin/echo [SHORT-OPTION]... [STRING]...
or: /usr/bin/echo LONG-OPTION
Echo the STRING(s) to standard output.
-n do not output the trailing newline
etc.
Were you thinking of the Bash builtin?enriquto
10 days ago
I don't expect any such ugly shit. A call to echo should print its arguments, no exceptions.
NAME
echo - echo arguments
SYNOPSIS
echo [ arg ... ]
DESCRIPTION
Echo writes its arguments in order as a line on the standard
output file. It is mainly useful for producing diagnostics
in command files.
scubbo
10 days ago
Exceptions to rules cause mental overhead and maintenance headaches. Why should `echo` be the single solitary tool that responds differently to invocation with `--help`?
enriquto
9 days ago
Let me play the uno reverse card: why should "--help" be the single solitary string that echo does not print like the others?
scubbo
9 days ago
For two reasons, both related to the Principle of Least Astonishment: * Because the likelihood that someone entering `echo --help` _actually_ wants to print `--help` is staggeringly low * Because it's not the "single solitary string" that has special handling - `echo -n` does not print `-n`. `echo` already supports flags, and so it would be most-consistent and least-surprising for it to also support a standard default one
tenacious_tuna
11 days ago
this 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
11 days 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
11 days ago
Okay.
$ 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
11 days ago
`man e2scrub_all` works without root :P
tenacious_tuna
10 days ago
Ansible'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.
blueflow
9 days ago
That is because Ansible documentation is generally poor. Ansible is one of the projects which i use every day and where the (online!) documentation rarely answers the questions i have. This forces me to fall back into a try & error that takes 10 times longer.
scbrg
11 days ago
I 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
11 days ago
I 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
11 days ago
Heh. 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
10 days ago
And... 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 :)
nurumaik
11 days ago
Just print help instead of any error during parsing