Subject: Re: [PATCH] _virsh (Was: Re: zsh virsh completion)
From: Marko Myllynen <[email-masked]>
To: Daniel Shahaf <[email-masked]>
Cc: [email-masked]
Date: Thu, 21 Jul 2016 15:32:14 +0300
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Hi,

On 2016-07-21 09:57, Daniel Shahaf wrote:
> Marko Myllynen wrote on Wed, Jul 20, 2016 at 11:36:36 +0300:
>> On 2016-07-20 09:58, Daniel Shahaf wrote:
>>> Marko Myllynen wrote on Mon, Jul 18, 2016 at 15:06:52 +0300:
>>>> +        _cache_virsh_cmds[$_cache_virsh_cmds[(i)$icmd]]=()
>>>> +      done
>>>>      fi
>>>>      if (( ! $+_cache_virsh_cmdopts )); then
>>>>        typeset -gA _cache_virsh_cmdopts
>>>>      fi
>>>>      _arguments -A "-*" -C -S -s -w \
>>>
>>> Oliver remarked on the -w earlier, are you quite sure it's correct?
>>>
>>>               -w     In combination with -s, allow option stacking even if one
>>>                      or more of the options take arguments.  For example, if
>>>                      -x takes an argument, with no -s, `-xy' is considered as
>>>                      a single (unhandled) option; with -s, -xy is an option
>>>                      with the argument `y'; with both -s and -w, -xy may be
>>>                      the option -x and the option -y with arguments still to
>>>                      come.
>>>
>>> (-s and -w are options to _arguments, -xy is a word on the command line
>>> being completed)
>>
>> I mentioned that virsh accepts all the following: -r -d 0, -r -d0, -rd
>> 0, or -rd0. So to me it would seem that -s -w is correct here, right?
> 
> All these require only -s [without -w].
> 
> Does virsh accept «-dr 0» where the 0 is argument to -d [regardless of
> whether -r takes an argument]?  _That_'s what -w is about.

Aha, no, it doesn't - yes that sounds very rare indeed, so much that I
didn't even think of that scenario.

> Could you suggest how to clarify the man page section I quoted?

Perhaps change "with both -s and -w, -xy may be the option -x and the
option -y with arguments still to come" to "... with arguments still to
come for -x"?

Thanks,

-- 
Marko Myllynen