[Toybox] --help annoyance
Rob Landley
rob at landley.net
Mon Oct 22 13:31:00 PDT 2018
On 10/22/2018 02:04 PM, enh wrote:
> On Thu, Oct 18, 2018 at 11:59 AM Rob Landley <rob at landley.net> wrote:
>> Most commands never _stop_ accepting flags:
>>
>> ls file file file -l
>> rm file file file -i
>
> interesting. in my mental model, i always assume "guideline 9"
> (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html).
>
> (but you're right, coreutils also seems to allow things like `ls / -l`.)
Yeah, guideline 9 is primarily honored in the breach. (To the point where git
doing it initially confused the heck out of me...)
Almost always when it does kick in for conventional command line utilities it's
because the meaning of options changes partway through, such as "xargs -1 ls -l"
where xargs better not parse that -l because it belongs to ls.
I implemented "netcat -l" where all the arguments after -l were the command line
to run and this confused people (commit f492fccc9ceb).
>> Weren't you the guy who wanted "see --help" instead of dumping help text all the
>> time? :)
>
> was i? i remember being the guy who wanted "(see --help)" rather than
> nothing, because i kept getting bug reports from folks who didn't even
> know there _was_ help.
Hmmm... Looks like it was more gradual than I remember... 29e75d51d447 then
ab33097058b0 then d3267c60ee48... I'm probably thinking of conversations in the
wrong context.
As for accepting --help anywhere... Hmmm. Currently --help and --version are
checked in the first argument before any other argument processing, which means
they're checked for commands that don't otherwise have a command line (and
there's a flag to suppress it for things like "true" defined to ignore ALL
arguments, so you have to "help true" or "toybox --help true" to get that one).
I suppose "touch ./--help ; ls *" is considered pilot error? (One of the
notes-to-self I have about toysh is whether * should expand to -- as its first
argument, which is too simple but how I have the todo item down. Really there
should be some toysh running internal commands context sensitivity, which is the
same as the "find . | xargs -> find . -print0 | xargs -0" todo item, that should
probably kick in automatically when you know both ends of the pipeline can
handle it. My version of tab completion being context sensitive. But again, this
is all way post 1.0 todo items...
I take it you don't want --version to apply just anywhere?
Rob
More information about the Toybox
mailing list