Search code examples
zsh-completion

Reuse options in _arguments for Zsh completion


I have a python program that utilizes action='append' of python. For example, I can use the command like this

mod_db -i $HOME -i $PWD -i /usr/local foo bar

How can I use _arguments or anything else to implement the Zsh completion?


Solution

  • Just found the answer by looking at the completion for gcc here. The solution is to add a * before the command. For example,

    _arguments -C \
         '*-i[a path]:path:_path_files -/' \
         ......