Skip to content

Commit

Permalink
Add autocomplete for gas. Based on the rvm plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
walle committed Jul 30, 2011
1 parent dee8171 commit d866662
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions plugins/gas/_gas
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d866662

Please sign in to comment.