]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/gas/_gas
initial
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / gas / _gas
1 #compdef gas
2
3 local curcontext="$curcontext" state line cmds ret=1
4
5 _arguments -C \
6         '(- 1 *)'{-v,--version}'[display version information]' \
7         '(-h|--help)'{-h,--help}'[show help information]' \
8         '1: :->cmds' \
9         '*: :->args' && ret=0
10
11 case $state in
12         cmds)
13                 cmds=(
14             "version:Prints Gas's version"
15             "use:Uses author"
16             "ssh:Creates a new ssh key for an existing gas author"
17             "show:Shows your current user"
18             "list:Lists your authors"
19             "import:Imports current user to gasconfig"
20             "help:Describe available tasks or one specific task"
21             "delete:Deletes author"
22             "add:Adds author to gasconfig"
23         )
24                 _describe -t commands 'gas command' cmds && ret=0
25                 ;;
26         args)
27                 case $line[1] in
28                         (use|delete)
29         VERSION=$(gas -v)
30         if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then
31           _values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0
32         else
33                                   _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
34         fi
35                 esac
36                 ;;
37 esac
38
39 return ret