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

Minor glitch with misuse of _describe; doc?



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



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