zsh 補完の強化
見様見真似でやってるので、もっとうまくやってください。
GNU Parallel
parallel の後に、コマンド名を補完する。補完されたコマンドの補完も有効。
#compdef parallel _arguments \ ':command:_command_names -e' \ '*::args:_normal'
paco
良く使うオプションを補完。-f, -r, -U には paco -a の結果を補完。最後は parallel 同様に、コマンド名を補完。
#compdef paco _arguments \ '-a' \ '-f:list:(`paco -a`)' \ '-lD' \ '-lp' \ '-ua' \ '-r[uninstall]:list:(`paco -a`)' \ '-U[remove only log]:list:(`paco -a`)' \ ':command:_command_names -e' \ '*::args:_normal'
TrueCrypt
私はテキストモードしか使わないので、これで十分。アンマウントは、truecrypt -t -l の結果から補完できる。
#compdef truecrypt mlist=(`truecrypt -t -l| gawk '{print $4;}'`) _arguments \ '-t[text mode]' \ '-l[mounted volume list]' \ '-d[dismount]:list:(${mlist})' \ '*::args:_files'