zsh-users
 help / color / mirror / code / Atom feed
* _describe usage
@ 2004-09-08  8:06 Boyd Adamson
  2004-09-08 13:34 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Boyd Adamson @ 2004-09-08  8:06 UTC (permalink / raw)
  To: zsh-users

Hi,

I'm working on my first completion code for a non-trivial command, and I
don't understand what _describe is doing (or how to get it to do what I
want).

What I want is to see something like this in menu selection:
fruit
apple   banana
animal
cat     dog   

I've tried a couple of approaches. My reading of the man page seems to
imply I can do this:

    rts=(apple banana)
    srts=(cat dog)
    _describe "fruit" rts -- "animal" srts

But that gets me this:

jarrah:/# scrgadm -a -j blah -t <tab>
fruit
        apple   banana

and if I menuselect to the blank position under "fruit" I get "cat" on
the commmand line!

I also tried this:

    rts=(apple banana)
    srts=(cat dog)
    _describe "fruit" rts 
    _describe "animal" srts 

But then I see:

jarrah:/# scrgadm -a -j blah -t <tab>
fruit
animal
apple   banana  cat     dog   


What am I doing wrong?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: _describe usage
  2004-09-08  8:06 _describe usage Boyd Adamson
@ 2004-09-08 13:34 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2004-09-08 13:34 UTC (permalink / raw)
  To: Boyd Adamson; +Cc: zsh-users

Boyd Adamson wrote:
> I've tried a couple of approaches. My reading of the man page seems to
> imply I can do this:
> 
>     rts=(apple banana)
>     srts=(cat dog)
>     _describe "fruit" rts -- "animal" srts

You can't specify a different description for the second group (after
`--'). Only other completion options like suffixes.

> I also tried this:
> 
>     rts=(apple banana)
>     srts=(cat dog)
>     _describe "fruit" rts 
>     _describe "animal" srts 

That would work if you specify a different tag for the two sets of
completions:
  _describe -t fruits fruit rts
  _describe -t animals animal srts

Otherwise, both fruits and animals are added with the tag `values'. It
is the tag rather than the description which determines the grouping of
matches.

Oliver


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-08 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-08  8:06 _describe usage Boyd Adamson
2004-09-08 13:34 ` Oliver Kiddle

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).