From fde58d0dd75cdc6a5340174a48fad3be7f9d87e5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 25 Sep 2011 19:45:41 -0400 Subject: [PATCH] Add gas completion --- _gas | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 _gas diff --git a/_gas b/_gas new file mode 100644 index 0000000..18da7e4 --- /dev/null +++ b/_gas @@ -0,0 +1,48 @@ +#compdef gas +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for gas (https://github.com/walle/gas). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Fredrik Wallgren +# +# ------------------------------------------------------------------------------ + +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 , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + ;; + esac + ;; +esac + +return ret +