]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Initial zsh completion
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 17 Aug 2013 01:42:46 +0000 (22:42 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 17 Aug 2013 01:42:46 +0000 (22:42 -0300)
lib/keyringer/completions/bash/keyringer [moved from lib/keyringer/completions/bash with 100% similarity]
lib/keyringer/completions/zsh/_keyringer [new file with mode: 0644]

diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer
new file mode 100644 (file)
index 0000000..1f1c250
--- /dev/null
@@ -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 "$@"