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

Re: optional argument?



Tanaka Akira wrote:

> I think `optional arguments' of _arguments doesn't work now.
> 
> Z(4):akr@serein% Src/zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D
> serein% _tst () { _arguments '-o::optarg:(optarg)' ':arg1:(arg1)' }
> serein% compdef _tst tst
> serein% tst -o <TAB>
> ->
> serein% tst -o optarg 
> 
> If I understand correctly, this should completes `arg1' as well as
> `optarg'.

Hm, maybe it's time to change it...

Currently we only support completing options and the optional argument 
at the same time.

The problem is the `->' case: _arguments can't `add' matches for more
than one `->state' because it doesn't add any of them.

This is also related to the other question we had for _arguments some
time ago: supporting different `modes' with different sets of options
and arguments. For that we would need this multi-action thing, too. I
then suggested to support multiple `->state' things by reporting (to
the function calling _arguments) strings of the form `state1-state2'.
Or maybe I didn't suggest it, only thought of it.

In that case we could also make _alternative support `->state's.

Hm, I'll have a peep at this at the weekend, but don't promise
anything... ;-}


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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