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

Re: completion with descriptions



Andy Spiegl wrote:
> How can I provide a description for every offered completion
> like e.g. "kill" does it nicely?
> 
> In my completion function I tried like this:
>    ':cmds: compadd ${${(f)"$(gigaset --commands)"}%%[[:space:]]##--*}' \

You need to use the _describe function; see the zshcompsys manual.
There are examples of this buried in various places.  You probably won't
be able to do it inline; you need to create an array with elements
containing both completions and descriptions separated by a colon.

Here's a noddy example.

_foo() {
  local -a d
  d=(foo:"The word foo" bar:"A rod")
  _describe "noddy example" d
}
compdef _foo foo

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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