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

Re: Completion error message



On Thu, Jan 25, 2018 at 9:24 PM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> Daniel Shahaf wrote:
>> «rsync -4 -6 --<TAB>» does nothing and prints nothing.
>>
>> I get why it _does_ nothing — -4 and -6 are mutually exclusive, so the
>> command line is invalid and it makes no sense to continue — but
>> shouldn't it print an error message?
>
> Note that _rsync uses _arguments sets. Without sets, it will complete
> further options. With sets, it is aggressive about disabling
> sets such that it can narrow things to the intended set. Unfortunately,
> that can easily result in all sets being deactivated.
>
> The inactive option (-6) is seen as an invalid argument when parsing for
> each of the two sets. Both sets get disabled and there's no completion.
> As I mentioned in 40129, we could do something with marking sets for
> fallback and examine them twice.
>
> This also affects things without sets, try this:
>   _arguments '(-6)-4' '(-4)-6' -a -b '1:arg1:(1)' '2:arg2:(2)'
>
> The -6 option gets taken as the first positional argument and '2' gets
> completed. What do you think it should complete there?
> Most commands don't like position arguments to look like options.
>
> I'm not especially keen on producing error messages from completion.

For most other commands you get
% zsh --aoentuh<tab>
---- no match for: `script file', `directory', or `option'

And it's also sort of surprising that _complete_help does nothing at all.

-- 
Mikael Magnusson



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