From: Silvio Rhatto Date: Sat, 17 Aug 2013 01:42:46 +0000 (-0300) Subject: Initial zsh completion X-Git-Tag: 0.2.2~16 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=26dbb6af9ebf1d55b1543ff4db86f83f2a59307d;p=keyringer.git Initial zsh completion --- diff --git a/lib/keyringer/completions/bash b/lib/keyringer/completions/bash/keyringer similarity index 100% rename from lib/keyringer/completions/bash rename to lib/keyringer/completions/bash/keyringer diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer new file mode 100644 index 0000000..1f1c250 --- /dev/null +++ b/lib/keyringer/completions/zsh/_keyringer @@ -0,0 +1,30 @@ +#compdef keyringer + +_keyringer() { + local curcontext="$curcontext" state line + typeset -A opt_args + + # Initial options + local config="$HOME/.keyringer" + local keyrings="`ls $config | sed -e 's/config//'`" + + _arguments \ + '1: :->keyring'\ + '2: :->action'\ + '*: :->options' + + case $state in + keyring) + _arguments "1:Keyrings:($keyrings)" + ;; + action) + compadd "$@" `keyringer $words[2] commands` + ;; + *) + # TODO + true + ;; + esac +} + +_keyringer "$@"