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

Re: Update _virsh completion



Hi,

On 2016-09-02 21:20, Daniel Shahaf wrote:
> Marko Myllynen wrote on Fri, Sep 02, 2016 at 12:36:44 +0300:
> 
>> By the way, I noticed one corner case where the connection URI is not
>> passed properly, I think this is pretty uncommon but I wonder should
>> this be handled by _libvirt or perhaps in a more generic way?
>>
>> $ unset LIBVIRT_DEFAULT_URI
>> $ virsh -c qemu:///system start --domain <TAB>
>> $ LIBVIRT_DEFAULT_URI=qemu:///system virsh start --domain <TAB>
>>
>> So there the former works, the latter doesn't.
> 
> How would you handle
> 
>     % LIBVIRT_DEFAULT_URI=foo://bar
>     % unset LIBVIRT_DEFAULT_URI; virsh start <TAB>
> 
> or
> 
>     % unset LIBVIRT_DEFAULT_URI
>     % LIBVIRT_DEFAULT_URI=$(/this/command/is/not/idempotent/or/not/deterministic) virsh start <TAB>
> 
> ?  Both in the «_call_program foo ...$words[N]...» case above and in the
> two cases here, the question is how much it is okay to eval the argument
> at a <TAB>.
> 
> (By the way, zsh-syntax-highlighting faces a similar issue, for example
> when it needs to determine whether a command word, which is a parameter
> expansion, refers to an alias or to a function.)

Good points, yeah, can't see an easy solution to those but since at
least in the case of _libvirt it's likely to be a corner case shouldn't
be too much of an issue.

Thanks,

-- 
Marko Myllynen



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