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

Re: --help trough _use_lo , but how with -h style?



Matthias Kopfermann wrote:

> Hi again,
> After I got the information about the use of `compdef _use_lo x y z' to
> have x y and z commands completed I asked myself:
> How can i do it with these `-h' commands. e.g. mutt only wants 
> -x flags. i would like to have such commands being completed just
> like the much nicer to read --x commands. is there a function
> already for these kind of commands? (I am not talking about a
> specific mutt completion though that may be nice, too.)
> 
> BTW: i used to use perl for having --help commands being
> completed and i have a function that does it with -h commands ,
> too,  but it would be much nicer, if there was such a function in
> plain-zsh already. Thats why i ask.

No, we don't have that yet. But we have a completion function for mutt.


Hm, if you have a function to generate the option names you can easily 
use that. I guess the function puts the options into the $reply array
(I'll assume the strings generated include the `-'), so you can do:

  _use_so() { # ;-)
    if [[ $PREFIX = -* ]]; then
      ... # call perl-function-thingy
      compadd -a reply
    else
      _default
    fi
  }

To make this nicer, change the `compadd'-line to:

  local expl
  _wanted options expl option compadd -a reply


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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