Implement plugin for Go Version Manager

This commit is contained in:
Gábor Lipták 2016-11-11 18:57:05 -05:00
commit 507e9dc566
2 changed files with 35 additions and 0 deletions

30
plugins/gvm/_gvm Normal file
View file

@ -0,0 +1,30 @@
#compdef gvm
#autoload
[[ -f "$GVM_ROOT/scripts/gvm" ]] || return 0
local -a _1st_arguments
_1st_arguments=(
'version:print the gvm version number'
'get:gets the latest code (for debugging)'
'use:select a go version to use (--default to set permanently)'
'diff:view changes to Go root'
'help:display this usage text'
'implode:completely remove gvm'
'install:install go versions'
'uninstall:uninstall go versions'
'cross:install go cross compilers'
'linkthis:link this directory into GOPATH'
'list:list installed go versions'
'listall:list available versions'
'alias:manage go version aliases'
'pkgset:manage go packages sets'
'pkgenv:edit the environment for a package set'
)
_arguments -C '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "gvm subcommand" _1st_arguments
return
fi

View file

@ -0,0 +1,5 @@
# Set GVM_ROOT if it isn't already defined
[[ -z "$GVM_ROOT" ]] && export GVM_ROOT="$HOME/.gvm"
# Load gvm if it exists
[[ -f "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"