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

Re: Completing multiple states with _arguments



On Tue, 9 Nov 2010 23:49:41 +0100
Nikolai Weibull <now@xxxxxxxx> wrote:

> Hi!
> 
> How do I deal with multiple states when completing with _arguments?
> 
> local context state line
> typeset -A opt_args
> 
> _arguments \
>   ':: :->something-optional-before-files' \
>   '*:: :->file' && ret=0
> 
> # Now what?

Usually you would use "case $state ... esac" to handle the states, with
matches against something-optional-before-files, file, etc.  There are
quite a few uses of this if you search for $state in completion.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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