Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion function help
- X-seq: zsh-workers 25695
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: Bismark <bismark@xxxxxxxxxx>
- Subject: Re: completion function help
- Date: Fri, 19 Sep 2008 22:54:51 +0200
- Cc: zsh-workers@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=wH70yvIZ9h7daPcn2Zxg9gZqRmQ0f2J7/qPcFDj37GM=; b=N8tv7fz2xEqb9LzJFuhShhuIXloRNZC08gLd6UCgTbUUlTyQGSL/GDPeU2XrgN2jp7 Ez7BGlStviDT/Evpa5ISR9SM8hL02NTTovMNCzPPPCtn653IjtcnKrMRMLWVaeEIH764 LdYBCy9Qp2NXWbPX0ZtK3V+5QOSBXjfKXez3A=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=N07LJTgYXaEctvAqDZUyZK5sUL9ZyVbsmpVB1EO2gj920j1HH5cb7yIuloFeaV6lxw H+AvWbIvJUNhU3lyIgUlkaPCrZH2pdBBBI2O6NthHImPiEtLZgc/G92pnfAXzyoqD4L0 QiV+xP4tWNUnylfMARHPe1VfxkIArmL+khF0o=
- In-reply-to: <48D40EEB.3040404@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <48D40EEB.3040404@xxxxxxxxxx>
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