| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,34 @@ |
| 0 |
+#compdef gas |
|
| 1 |
+ |
|
| 2 |
+local curcontext="$curcontext" state line cmds ret=1 |
|
| 3 |
+ |
|
| 4 |
+_arguments -C \ |
|
| 5 |
+ '(- 1 *)'{-v,--version}'[display version information]' \
|
|
| 6 |
+ '(-h|--help)'{-h,--help}'[show help information]' \
|
|
| 7 |
+ '1: :->cmds' \ |
|
| 8 |
+ '*: :->args' && ret=0 |
|
| 9 |
+ |
|
| 10 |
+case $state in |
|
| 11 |
+ cmds) |
|
| 12 |
+ cmds=( |
|
| 13 |
+ "version:Prints Gas's version" |
|
| 14 |
+ "use:Uses author" |
|
| 15 |
+ "show:Shows your current user" |
|
| 16 |
+ "list:Lists your authors" |
|
| 17 |
+ "import:Imports current user to gasconfig" |
|
| 18 |
+ "help:Describe available tasks or one specific task" |
|
| 19 |
+ "delete:Deletes author" |
|
| 20 |
+ "add:Adds author to gasconfig" |
|
| 21 |
+ ) |
|
| 22 |
+ _describe -t commands 'gas command' cmds && ret=0 |
|
| 23 |
+ ;; |
|
| 24 |
+ args) |
|
| 25 |
+ case $line[1] in |
|
| 26 |
+ (use|delete) |
|
| 27 |
+ _values -S , 'rubies' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 |
|
| 28 |
+ ;; |
|
| 29 |
+ esac |
|
| 30 |
+ ;; |
|
| 31 |
+esac |
|
| 32 |
+ |
|
| 33 |
+return ret |