summaryrefslogtreecommitdiff
path: root/shell/zsh-completion
diff options
context:
space:
mode:
authorJason Ryan <jasonwryan@gmail.com>2014-08-21 06:26:31 +1200
committerDave Reisner <dreisner@archlinux.org>2014-08-20 18:44:21 -0400
commit7f6ce5326c8d09230ef819f5aaa1a0d321919f80 (patch)
tree590dc65046490a533b556841ee1c1c1b46627853 /shell/zsh-completion
parent5ef73d04af4caf815988a08bd55dfcee26806685 (diff)
downloadasp32-7f6ce5326c8d09230ef819f5aaa1a0d321919f80.tar.xz
Initial commit of zsh completion
Diffstat (limited to 'shell/zsh-completion')
-rw-r--r--shell/zsh-completion46
1 files changed, 46 insertions, 0 deletions
diff --git a/shell/zsh-completion b/shell/zsh-completion
new file mode 100644
index 0000000..e26718b
--- /dev/null
+++ b/shell/zsh-completion
@@ -0,0 +1,46 @@
+#compdef asp
+
+_asp_command() {
+ local -a _asp_cmds
+ _asp_cmds=(
+ 'checkout'
+ 'difflog'
+ 'export'
+ 'gc'
+ 'disk-usage'
+ 'help'
+ 'list-all'
+ 'list-arches'
+ 'list-local'
+ 'list-repos'
+ 'log'
+ 'shortlog'
+ 'update'
+ 'untrack'
+ )
+
+if (( CURRENT == 1 )); then
+ _describe -t commands 'asp command' _asp_cmds || compadd "$@"
+else
+ local curcontext="$curcontext"
+ cmd="${${_asp_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $#cmd )); then
+ if (( $+functions[_asp_$cmd] )); then
+ _asp_$cmd
+ else
+ _message "no more options"
+ fi
+ else
+ _message "unknown asp command: $words[1]"
+ fi
+fi
+}
+
+_arguments \
+ '-a[architecture]' \
+ '-f[overwrite files]' \
+ '-h[print help and exit]' \
+ '-V[print version and exit]' \
+ '*::asp command:_asp_command'
+
+# vim: set et sw=2 ts=2 ft=zsh :