zsh-workers
 help / color / mirror / code / Atom feed
* Minor glitch with misuse of _describe; doc?
@ 2013-10-04 14:42 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2013-10-04 14:42 UTC (permalink / raw)
  To: zsh-workers

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 ?)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-04 14:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04 14:42 Minor glitch with misuse of _describe; doc? Bart Schaefer

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).