zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Update _virsh completion
Date: Wed, 31 Aug 2016 23:44:41 +0200	[thread overview]
Message-ID: <14008.1472679881@hydra.kiddle.eu> (raw)
In-Reply-To: <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


  reply	other threads:[~2016-08-31 21:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29  8:03 Marko Myllynen
2016-08-31 17:49 ` Daniel Shahaf
2016-08-31 21:44   ` Oliver Kiddle [this message]
2016-09-01 16:01     ` Daniel Shahaf
2016-09-02  9:36   ` Marko Myllynen
2016-09-02 18:20     ` Daniel Shahaf
2016-09-04 18:26       ` Daniel Shahaf
2016-09-05  6:29       ` Marko Myllynen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14008.1472679881@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).