[Toybox] --help annoyance
enh
enh at google.com
Thu Oct 18 11:12:27 PDT 2018
Yeah, my assumption was that as long as I'm still in the flags, --help
should work. (But not *anywhere*.)
Personally, I often just add --help on the end of what I've already typed
if I get stuck.
For this specific case, I think in my ideal world, a flag that takes
arguments from a list should probably show that list any time it gets
something it doesn't understand? But I don't think this is a regression, so
I don't think it makes sense to try to rush something into this release.
On Thu, Oct 18, 2018, 10:39 Rob Landley <rob at landley.net> wrote:
> Sorry for the delay, everything you wrote yesterday wound up in gmail's
> spam
> filter again.
>
> On 10/17/2018 04:51 PM, enh wrote:
> > i wanted to check that the Android scheduler policy output wasn't
> > broken by recent changes, but i can't remember what the -O option is
> > called...
> >
> > # ps -A -O
> > ps: Missing argument to -O (see "ps --help")
>
> And "ps --help" says:
>
> Which FIELDs to show. (-o HELP for list, default = -o PID,TTY,TIME,CMD)
>
> I.E. "ps -O help". (All the fields are case insensitive, "help" is just a
> special field.)
>
> The global "--help" has only ever been recognized as the first option.
> Should I
> change that?
>
> The problem is it would ignore all other options, meaning "rm -rf file
> file file
> file file --help file file" would prevent those files from getting deleted,
> which seems like a security issue waiting to happen.
>
> > fair enough. (though maybe we should have a special case for things
> > that take an option and just assume that you need to know what the
> > options are?)
> >
> > # ps -A -O --help
> > ps: bad -O '--help'
> > ^
>
> I take it you'd like -O to also accept "ps -O --help" as the field name?
>
> > okay, fair enough. that one seems unavoidable.
> >
> > # ps -A --help
> > ps: Unknown option help (see "ps --help")
> >
> > that's pretty annoying though...
>
> That's "--help only works as the first argument" again.
>
> If you're ok with the security hole I could make it check all the
> arguments. I'd
> have to duplicate to -- check to stop early, it's not lib/args doing this
> because lots of standalone commands build without lib/args and it saves
> several
> kilobytes in each of those. That's this blob in main.c dropping it out:
>
> https://github.com/landley/toybox/blob/master/main.c#L60
>
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20181018/5fea85ea/attachment-0001.htm>
More information about the Toybox
mailing list