Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: PATCH: Re: sudo completion problem



>
> Hm. From the logic of the specifications used by _sudo, this
> completion is correct, after all, there may be options between
> arguments unless otherwise specified.
>
> So this adds the special string `-' for exclusion lists which makes
> the description for the options not be used any more. And it makes
> this be used in the places where we have such _command_names/_normal
> combinations.
>


No, that is wrong approach. As Zefram pointed out, the logic is: first
argument terminates options. Anything after first argument must NOT be
trated as option. Cf.:

bor@itsrm2% diff  .zshrc --r
diff: Cannot access --r: No such file or directory

This applies to *all* arguments cases, not just a case with _normal.
Currently we get:

bor@itsrm2% gdiff --brief .zshrc -r<TAB>
bor@itsrm2% gdiff --brief .zshrc -r
Completing option
-B                        -- ignore lines that are all blank
-H                        -- assume large files and many small changes
-I                        -- ignore lines that match regex
.....

but in this case the ``--r'' is *argument* (== file) and not an option
any more:

bor@itsrm2% gdiff --brief .zshrc -r
gdiff: missing operand
gdiff: Try `gdiff --help' for more information.

The weird is, that *long* options (at least in this case) are
interpreted everywhere:

bor@itsrm2% gdiff --brief .zshrc --r
gdiff: option `--r' is ambiguous
gdiff: Try `gdiff --help' for more information.

In other words, what we need, is:

- short options must be treated consistent with Unix. First non-option
argument terminates short options. Because it is normal, default
behaviour - I suggest reverting change for find (to avoid modifying
*every* completion function) and

- for rare cases, when arguments and options (or what looks like
options - in case of find) can be intermixed - some way to express it is
needed. Option for _arguments may be?

- can somebody comment on long options case - is it expected behaviour?
Note, that I mean in this case "GNU long options". In this case, again,
_arguments should differentiate bewteen long and short case, again with
option. There are enough commands out there that use "long" options but
not GNU ones.

-andrej



Messages sorted by: Reverse Date, Date, Thread, Author