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

Re: Help with completion of option arguments



On 7/9/05, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I mention this to point out that it's almost always better to show the
> real example you're working with, rather than attempt to make up an
> equivalent one.  The exception would be when you're showing a minimal
> test case for a bug, but then you should have tried the example to be
> sure it demonstrates what you intend it to.

OK.  I'll do that next time for sure.  Sorry about the confusion.  The
completion, which is my first, is at
http://www.travisspencer.com/scripts/_snot.txt.  I'm kinda pleased
with the way it turned out.  Thanks for all the help with it, Bart!

> By the way, does your call to _arguments use the ->state mechanism at
> any point?  If not, you don't need the -C in there.

Ya, I am using the state mechanism.

> However, the literal answer to your question ...
> 
> } Is there some way to get _arguments to output the messages `test
> } sub-message' and `suppress interactive query (for use in crontab)'
> } when `-A' or `-B' have been input rather than completing them
> } directly?
> 
> ... is, insert an empty string element into the double-parens like this:
> 
> _arguments : \
>     "-A-[this is a test]:test:(('' a\:'test sub-message'))" \
>     "-B-[notify (e-mail) admins]:notify:((''
>         b\:'suppress interactive query (for use in crontab)'))"

Wow. Tricky.  I would never have figured that out on my own.

-- 

Regards,

Travis Spencer
Portland, OR USA



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