<div dir="auto"><div>Yeah, my assumption was that as long as I'm still in the flags, --help should work. (But not *anywhere*.)<div dir="auto"><br></div><div dir="auto">Personally, I often just add --help on the end of what I've already typed if I get stuck. </div><br><br>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. <br><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 18, 2018, 10:39 Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for the delay, everything you wrote yesterday wound up in gmail's spam<br>
filter again.<br>
<br>
On 10/17/2018 04:51 PM, enh wrote:<br>
> i wanted to check that the Android scheduler policy output wasn't<br>
> broken by recent changes, but i can't remember what the -O option is<br>
> called...<br>
> <br>
> # ps -A -O<br>
> ps: Missing argument to -O (see "ps --help")<br>
<br>
And "ps --help" says:<br>
<br>
Which FIELDs to show. (-o HELP for list, default = -o PID,TTY,TIME,CMD)<br>
<br>
I.E. "ps -O help". (All the fields are case insensitive, "help" is just a<br>
special field.)<br>
<br>
The global "--help" has only ever been recognized as the first option. Should I<br>
change that?<br>
<br>
The problem is it would ignore all other options, meaning "rm -rf file file file<br>
file file --help file file" would prevent those files from getting deleted,<br>
which seems like a security issue waiting to happen.<br>
<br>
> fair enough. (though maybe we should have a special case for things<br>
> that take an option and just assume that you need to know what the<br>
> options are?)<br>
> <br>
> # ps -A -O --help<br>
> ps: bad -O '--help'<br>
> ^<br>
<br>
I take it you'd like -O to also accept "ps -O --help" as the field name?<br>
<br>
> okay, fair enough. that one seems unavoidable.<br>
> <br>
> # ps -A --help<br>
> ps: Unknown option help (see "ps --help")<br>
> <br>
> that's pretty annoying though...<br>
<br>
That's "--help only works as the first argument" again.<br>
<br>
If you're ok with the security hole I could make it check all the arguments. I'd<br>
have to duplicate to -- check to stop early, it's not lib/args doing this<br>
because lots of standalone commands build without lib/args and it saves several<br>
kilobytes in each of those. That's this blob in main.c dropping it out:<br>
<br>
<a href="https://github.com/landley/toybox/blob/master/main.c#L60" rel="noreferrer noreferrer" target="_blank">https://github.com/landley/toybox/blob/master/main.c#L60</a><br>
<br>
Rob<br>
</blockquote></div></div></div>