aboutsummaryrefslogtreecommitdiffstats
path: root/src/_gas
diff options
context:
space:
mode:
authorJulien Nicoulaud <julien.nicoulaud@gmail.com>2012-08-01 13:23:11 +0200
committerJulien Nicoulaud <julien.nicoulaud@gmail.com>2012-08-01 13:23:11 +0200
commit10ffeb0c153258896531b2b8939e94486d58b378 (patch)
treef735059d34c7f2ade7eb410643f39ecf402833d9 /src/_gas
parentAdd call for deb and rpm packagers (diff)
downloadzsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.tar
zsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.tar.gz
zsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.tar.bz2
zsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.tar.lz
zsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.tar.xz
zsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.tar.zst
zsh-completions-10ffeb0c153258896531b2b8939e94486d58b378.zip
[BREAKING CHANGE] Move compdefs to own directory (to ease packaging and
avoid bloating users fpath with unneeded files such as README.md)
Diffstat (limited to 'src/_gas')
-rw-r--r--src/_gas48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/_gas b/src/_gas
new file mode 100644
index 0000000..18da7e4
--- /dev/null
+++ b/src/_gas
@@ -0,0 +1,48 @@
+#compdef gas
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for gas (https://github.com/walle/gas).
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * Fredrik Wallgren <fredrik.wallgren@gmail.com>
+#
+# ------------------------------------------------------------------------------
+
+local curcontext="$curcontext" state line cmds ret=1
+
+_arguments -C \
+ '(- 1 *)'{-v,--version}'[display version information]' \
+ '(-h|--help)'{-h,--help}'[show help information]' \
+ '1: :->cmds' \
+ '*: :->args' && ret=0
+
+case "$state" in
+ (cmds)
+ cmds=(
+ "version:Prints Gas's version"
+ "use:Uses author"
+ "show:Shows your current user"
+ "list:Lists your authors"
+ "import:Imports current user to gasconfig"
+ "help:Describe available tasks or one specific task"
+ "delete:Deletes author"
+ "add:Adds author to gasconfig"
+ )
+ _describe -t commands 'gas command' cmds && ret=0
+ ;;
+ (args)
+ case "$line[1]" in
+ (use|delete)
+ _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
+ ;;
+ esac
+ ;;
+esac
+
+return ret
+