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

Re: completion function help



2008/9/19 Bismark <bismark@xxxxxxxxxx>:
> I'm trying to right a command completion function and I'm stuck.  I've
> been looking through examples and the documentation but having no luck.
>
> What I'm looking for is for the parameters for an option to a command to
> have a description. I've gotten the completion to work for the command
> but when I complete the option I only get the values.
>
> $ medusa -
> option
> -C  -- File containing combo entries. (see man page)
> -H  -- Reads Target specifications from a file.
> -P  -- Reads Passwords from a file.
> -U  -- Reads Usernames from a file.
> -e  -- Additional password checks
> -h  -- Target hostname or IP address.
> -p  -- Password.
> -u  -- Username.
>
> $ medusa -e
> Additional password checks
> n   ns  s
>
> I would like it to display something like the following
>
> $ medusa -e
> Additional password checks
> n       -- No Password
> s       -- Username = Password
> ns      -- No Password & Username = Password
>
> What is the best way to go about doing this?

It would of course help a lot if you also posted your code, but at a guess,
where you have -d array in your compdef call, change it to -ld array, where
array is the array with your descriptions, i think. Maybe the problem is
you don't have a -d array at all. ie
mydescriptions=('No Password' 'Username = Password' etc)
compdef blabla -ld mydescriptions blabla

-- 
Mikael Magnusson



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