Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Update _virsh completion
- X-seq: zsh-workers 39146
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Update _virsh completion
- Date: Wed, 31 Aug 2016 23:44:41 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1472679883; bh=8e8XMlq6Z34ZJcf9ugb1fvRS2JhJ6bN9705rGEQ7WMA=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=juFkG3G0a7/U/Wx9dExEZhhhKyyZrD2ZIu79Yqsd+wdsUcSaTx9XriKFTBOX2VUejneOYouQrUnI5V6+Dyq9BY8uwaZZJ+oEc9XuwZkK9mIhY34qoRGJaE5giSTXe7EEWjMPP3o1cIoMhlLJTqNYhZvvCXOrvg8R09P4xjrywEXx1EOpEn9I7AndQG8lK0rh8eO4Zrte6n1rAibsQ2vsfNuDAJ1MDLHaqOIp9VoiZZTTLzm7/WQqkfyRrNCgNOcl0CMZdciRqo/c6TmaIr+w1Cvsne6yT6gwYyNCsFIz69fpMQNYcr3djB6qNGAa9KaPoJHMb96vwhTALFD0WVvP+A==
- In-reply-to: <20160831174915.GA11043@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <f957d4aa-d989-6252-14d2-0cc57afdab68@redhat.com> <20160831174915.GA11043@fujitsu.shahaf.local2>
Daniel Shahaf wrote:
> Marko Myllynen wrote on Mon, Aug 29, 2016 at 11:03:13 +0300:
> > The patch below (almost) completes _virsh completions:
Thanks. I committed it. Daniel has covered most of the points I wanted to
make.
One thing I found relating to virsh, having checked a system that
actually uses libvirt is that there was some virtual machines that
were listed with --inactive but not with --state-shutoff. virsh start
was able to start them.
> > $ virsh start --domain foo --autodestroy <TAB>
> > --autodestroy --console --pass-fds
>
> That's because the expansion contains "--autodestroy" twice. You can
> easily uniquify the expansion with ${(u)foo} (or 'typeset -aU').
I think it is caused by the presence of the word foo on the
line which is not one of the values passed to _values. I'd be inclined
to use _arguments instead of _values and have it handle things like
--domain taking and argument.
For a number of the other new uses of _values, _wanted would be
sufficient. It may be longer to write "_wanted tag expl desc compadd
…" than "_values desc …" but it does a lot less. If you do stick
with _values, the convention for descriptions is not to use plural,
e.g server instead of servers. The description describes what should
be entered (e.g. a server) not what the listed matches are (e.g.
servers).
> > - if (( ! $+_cache_virsh_cmdopts )); then
> > - typeset -gA _cache_virsh_cmdopts
> > + if (( ! $+_cache_virsh_cmd_opts )); then
> > + typeset -gA _cache_virsh_cmd_opts
>
> There's a cache mechanism in compsys, see the 'use-cache' style.
> However, I don't know whether it would make sense to use it here.
That only really makes sense when generating the matches is particularly
slow which isn't the case here.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author