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

_arguments problems



I re-read the item of _arguments in zshcompsys(1) and found some
problems.  (and wrote BNF for a personal reference.)

Z(4):akr@serein% Src/zsh -f
serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst

(1)
serein% _tst () { _arguments '-o:*a:a:(a)' ':A:(A)' ':B:(B)' }
serein% tst A -o a <TAB>
->
serein% tst A -o a 
_tags:comptags:83: no tags registered
serein% tst A -o a
_tags:comptags:83: no tags registered
serein% tst A -o a

(2)
serein% _tst () { _arguments '-e:*last:::b:{compadd "${(j:,:)words}"}' }
serein% tst -e <TAB> last xxx
serein% tst -e ,last,xxx  last xxx

$words shouldn't have `xxx'.

(3)
The explanation of the example `(-foo):...' is wrong.

  ... in the  second
  example the argument described by the specification will
  not be offered if the option -foo is on  the  line. 

I think it's reverted.

(4)
serein% _tst () { _arguments '(*)-x' ':a:(a)' }
serein% tst -x <TAB>
->
serein% tst -x a 

Hm.  What's excluded by `*'?

(5)
serein% _tst () { _arguments '*-z:o:(o)' ':a:{compadd $opt_args[-z]}' }
serein% tst -z a -z b <TAB>
->
serein% tst -z a -z b b                

It should be `a:b'

(6)
serein% _tst () { _arguments '*-o:1:(1):*:rest:{compadd $curcontext}' }
serein% tst -o 1 <TAB><TAB>
serein% tst -o 1 :complete:tst:option-o-2 :complete:tst:option-o-2 

This is the behaviour which is described in zshcompsys(1).  But I
think it should be :complete:tst:option-o-rest

(7)
serein% _tst () { _arguments '*-o:1:(1):*:rest:{compadd $context}' }
serein% tst -o 1 <TAB>

It completes nothing.  context parameter is not set?
-- 
Tanaka Akira



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