52a99d947ec0529d84d63afb202c7f03289e6bfe
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #507 from walle/add_autocomplete_for_gas
Add autocomplete for gas
Diff
1diff --git a/plugins/gas/_gas b/plugins/gas/_gas
2new file mode 100644
3index 0000000000000000000000000000000000000000..befdc94598df69bba47201e6933829b4fb39fbce
4--- /dev/null
5+++ b/plugins/gas/_gas
6@@ -0,0 +1,34 @@
7+#compdef gas
8+
9+local curcontext="$curcontext" state line cmds ret=1
10+
11+_arguments -C \
12+ '(- 1 *)'{-v,--version}'[display version information]' \
13+ '(-h|--help)'{-h,--help}'[show help information]' \
14+ '1: :->cmds' \
15+ '*: :->args' && ret=0
16+
17+case $state in
18+ cmds)
19+ cmds=(
20+ "version:Prints Gas's version"
21+ "use:Uses author"
22+ "show:Shows your current user"
23+ "list:Lists your authors"
24+ "import:Imports current user to gasconfig"
25+ "help:Describe available tasks or one specific task"
26+ "delete:Deletes author"
27+ "add:Adds author to gasconfig"
28+ )
29+ _describe -t commands 'gas command' cmds && ret=0
30+ ;;
31+ args)
32+ case $line[1] in
33+ (use|delete)
34+ _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
35+ ;;
36+ esac
37+ ;;
38+esac
39+
40+return ret