On 10/21/2015 07:04 AM, Leslie S Satenstein wrote:
> Hi Eric
> I like your findings.  Can you see any wrong reason why the parser should not 
> first scan for -- arguments?

That's what the parser already does.  The question is whether the scan
should be one-pass or two-pass.

> I would like to see something like         " ls -l * --help "     tell me 
> what "ls -l" is about?   Regards 

No, be careful.  I specifically note that I _like_ the behavior of
options eating their arguments.  'ls -l * --help' will NOT always output
help, if the last file in the expansion of '*' resembles an option that
requires an argument.  I'm only requesting whether 'ls -l * --help
--help' is a guaranteed way to get help.

For a more concrete example,

chmod --reference --help .

must NOT print help, but instead must attempt to change the mode of '.'
to match the mode of the file './--help'.  On the other hand,

chmod --reference --help --help

SHOULD print help, even if the file './--help' does not exist.  (And in
fact, things work correctly here, because for chmod --reference, we do
not exit early).

The trick is the notion that options MUST eat their arguments before
scanning for --help, but fixing things so that no option can exit early
before --help has been scanned for across all possible options.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to