[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Priority of --help
From: |
Eric Blake |
Subject: |
Re: Priority of --help |
Date: |
Wed, 21 Oct 2015 07:17:18 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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
signature.asc
Description: OpenPGP digital signature