diff options
| author | navewindre <boneyaard@gmail.com> | 2025-07-13 06:42:05 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-07-13 06:42:05 +0200 |
| commit | 02f14a9cb152561a5e44062aac79f3b700403b40 (patch) | |
| tree | 2db8ebda3b7f6f8777783aeb5c60018e6e1359d8 /home/.oh-my-zsh/plugins/gas | |
| parent | cbbdeb2f6b40a102a829f0c47cff052937231f00 (diff) | |
omz
Diffstat (limited to 'home/.oh-my-zsh/plugins/gas')
| -rw-r--r-- | home/.oh-my-zsh/plugins/gas/README.md | 10 | ||||
| -rw-r--r-- | home/.oh-my-zsh/plugins/gas/_gas | 39 |
2 files changed, 49 insertions, 0 deletions
diff --git a/home/.oh-my-zsh/plugins/gas/README.md b/home/.oh-my-zsh/plugins/gas/README.md new file mode 100644 index 0000000..a0a7a56 --- /dev/null +++ b/home/.oh-my-zsh/plugins/gas/README.md @@ -0,0 +1,10 @@ +# Gas plugin + +This plugin adds autocompletion for the [gas](http://ramblingsby.me/gas/) command, +a utility to manage Git authors. + +To use it, add `gas` to the plugins array of your zshrc file: + +```zsh +plugins=(... gas) +``` diff --git a/home/.oh-my-zsh/plugins/gas/_gas b/home/.oh-my-zsh/plugins/gas/_gas new file mode 100644 index 0000000..23e6d99 --- /dev/null +++ b/home/.oh-my-zsh/plugins/gas/_gas @@ -0,0 +1,39 @@ +#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" + "ssh:Creates a new ssh key for an existing gas 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) + VERSION=$(gas -v) + if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then + _values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0 + else + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + fi + esac + ;; +esac + +return ret |
