zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Minor glitch with misuse of _describe; doc?
Date: Fri, 04 Oct 2013 07:42:56 -0700	[thread overview]
Message-ID: <131004074256.ZM4048@torch.brasslantern.com> (raw)

I was fiddling with trying to get multiple completion tag groups to all
align their match/description separators in a neat column, and wrote
this little (broken) completer:

_describe_t ()
{
    local -a commands extra
    commands=('one:command one' 'two:command two')
    extra=('extraone:extra command one'
           'zbiggertoshowthealignissue:extra command two')
    _describe -t commands 'commands' commands -- -t extra 'extra' extra 
}
compdef _describe_t zzz

Got this very unexpected result:

torch% zzz <TAB>
-                           extra                     
-2V                         extraone                  
-a                          -J                        
_a_13                       _tmpd                     
-d                          _tmpm                     
-D                          zbiggertoshowthealignissue
-default-                                             
one  # command one
two  # command two

The correct usage is (I think)

    _describe -t commands 'commands' commands -- extra

(that is, you can't repeat the "-t tag description" part after the "--")
but something about throwing too many arguments after the "--" causes a
bunch of internal bits of _describe to show up as possible completions.

What exactly are the "completion options OPTS" that can be passed through
_describe as mentioned in the manual?

  _describe [ -oO | -t TAG ] DESCR NAME1 [ NAME2 ] OPTS ... -- ...
     This function associates completions with descriptions.  Multiple
     groups separated by -- can be supplied, potentially with different
     completion options OPTS.

I think perhaps that should say "compadd options"?

(Same for _combination ?)


                 reply	other threads:[~2013-10-04 14:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=131004074256.ZM4048@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).