zsh-workers
 help / color / mirror / code / Atom feed
From: "Mikael Magnusson" <mikachu@gmail.com>
To: Bismark <bismark@foofus.net>
Cc: zsh-workers@sunsite.dk
Subject: Re: completion function help
Date: Fri, 19 Sep 2008 22:54:51 +0200	[thread overview]
Message-ID: <237967ef0809191354k33cfa5eeib9d5e5df341032c4@mail.gmail.com> (raw)
In-Reply-To: <48D40EEB.3040404@foofus.net>

2008/9/19 Bismark <bismark@foofus.net>:
> 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


  reply	other threads:[~2008-09-19 20:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 20:43 Bismark
2008-09-19 20:54 ` Mikael Magnusson [this message]
2008-09-22 17:16   ` Bismark
2008-09-22 14:39 ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=237967ef0809191354k33cfa5eeib9d5e5df341032c4@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=bismark@foofus.net \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).