amon2-setup.plの zsh補完を書きました

http://gihyo.jp/dev/serial/01/perl-hackers-hub/001801


Web+DBの記事も Webで見れることになったので。

コード

flavor一覧は 'list-flavors'オプションから取得しているので、
独自の flavorをインストールしていてもおそらく補完されます。

#compdef amon2-setup.pl

local -a flavors
flavors=($(amon2-setup.pl -l | awk '{print $1}'))

_arguments -n : \
  '*--flavor=[Set up flavor]:flavors:'"($flavors)" \
  '--vc=[Setup the Version Control(Default is git)]: :(Git)' \
  '(-)'{--list-flavors,-l}'[Shows the list of flavors installed]' \
  '(-)--help[Show this help]' \
  '*: :()'

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

イメージ

オプションの指定

flavorの指定