[Toybox] --help annoyance
enh
enh at google.com
Mon Oct 22 22:32:43 PDT 2018
On Mon, Oct 22, 2018 at 1:31 PM Rob Landley <rob at landley.net> wrote:
>
>
>
> 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?
i don't think i've ever used --version other than _after_ getting a
weird response and wondering "wait, what am i actually running here?",
so, no, i doubt i would ever notice. (my `history` says it's almost
always clang, clang-format, gcc, java, ldd, and adb that i'm asking
the version of.)
if there was something between ^W and ^U that deleted back to the
previous command, i'd probably use that for "wait, what's that option
called again?". (my `history` says i almost always have `--help` as
the only argument anyway.)
> Rob
More information about the Toybox
mailing list