d866662c4af4c6e6e661c59d2da8f60eabbfba1d
- Author
- Fredrik Wallgren <fredrik.wallgren@gmail.com>
- Committer
- Fredrik Wallgren <fredrik.wallgren@gmail.com>
- Date
Message
Add autocomplete for gas. Based on the rvm plugin.
Diff
1diff --git a/plugins/gas/_gas b/plugins/gas/_gas
2new file mode 100644
3index 0000000000000000000000000000000000000000..069713fc6d5f0b9274add16f509d364c35884c51
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 , 'rubies' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
35+ ;;
36+ esac
37+ ;;
38+esac
39+
40+return ret