summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-08-16 22:42:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-08-16 22:42:46 -0300
commit26dbb6af9ebf1d55b1543ff4db86f83f2a59307d (patch)
tree051013e548a3bddc3fd6ef1aa5a9f0d38df71248
parent08ffd87bc84928ef5ca0792175323d441145f5ce (diff)
downloadkeyringer-26dbb6af9ebf1d55b1543ff4db86f83f2a59307d.tar.gz
keyringer-26dbb6af9ebf1d55b1543ff4db86f83f2a59307d.tar.bz2
Initial zsh completion
-rw-r--r--lib/keyringer/completions/bash/keyringer (renamed from lib/keyringer/completions/bash)0
-rw-r--r--lib/keyringer/completions/zsh/_keyringer30
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/keyringer/completions/bash b/lib/keyringer/completions/bash/keyringer
index 4459b34..4459b34 100644
--- a/lib/keyringer/completions/bash
+++ b/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 "$@"