From d866662c4af4c6e6e661c59d2da8f60eabbfba1d Mon Sep 17 00:00:00 2001 From: Fredrik Wallgren Date: Sat, 30 Jul 2011 04:38:57 +0200 Subject: [PATCH 1/2] Add autocomplete for gas. Based on the rvm plugin. --- plugins/gas/_gas | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/gas/_gas diff --git a/plugins/gas/_gas b/plugins/gas/_gas new file mode 100644 index 00000000..069713fc --- /dev/null +++ b/plugins/gas/_gas @@ -0,0 +1,34 @@ +#compdef gas + +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 , 'rubies' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + ;; + esac + ;; +esac + +return ret From c3412ca57d313a0a1419d26b5529f28de49285d0 Mon Sep 17 00:00:00 2001 From: Fredrik Wallgren Date: Sat, 30 Jul 2011 04:57:25 +0200 Subject: [PATCH 2/2] Replace forgotten rubies with authors --- plugins/gas/_gas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gas/_gas b/plugins/gas/_gas index 069713fc..befdc945 100644 --- a/plugins/gas/_gas +++ b/plugins/gas/_gas @@ -25,7 +25,7 @@ case $state in args) case $line[1] in (use|delete) - _values -S , 'rubies' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 ;; esac ;;