4 # 1. copy this file to your favorite directory (ex, ~/.zshrc.d/completion)
5 # 2. add below lines to your .zshrc:
6 # > fpath=(~/.zshrc.d/completion $fpath)
7 # > autoload -U compinit
9 # 3. push [tab] when you typing ethna command's argument.
13 # - we tested this function only with Debian/GNU Linux.
14 # - $Id: _ethna 411 2006-11-17 02:32:32Z ichii386 $
17 local curcontext="$curcontext" state line expl ret=1
20 '(-v --version)'{-v,--version}'[show version]' \
21 '1:ethna command:->ethna-cmd' \
22 '*:ethna command args:->ethna-cmd-arg' \
25 if [[ -n "$state" ]]; then
28 handles=( $($service | grep '^ \+.* -> .*:$' | awk '{print $1}') )
29 _wanted ethna-cmd expl 'ethna cmd' compadd -a handles && ret=0
32 usage=$($service | grep -A 1 "^ \+$words[2] ->")
33 if [[ -n "$usage" ]]; then
34 _wanted ethna-cmd-arg expl 'ethna cmd arg' compadd -x "$usage" && ret=0
36 _wanted ethna-cmd-arg expl 'ethna cmd arg' compadd -x "unknown command" && ret=0