From 507e9dc566f9037627c3ffc28813e14bbff33cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Lipt=C3=A1k?= Date: Fri, 11 Nov 2016 18:57:05 -0500 Subject: [PATCH] Implement plugin for Go Version Manager --- plugins/gvm/_gvm | 30 ++++++++++++++++++++++++++++++ plugins/gvm/gvm.plugin.zsh | 5 +++++ 2 files changed, 35 insertions(+) create mode 100644 plugins/gvm/_gvm create mode 100644 plugins/gvm/gvm.plugin.zsh diff --git a/plugins/gvm/_gvm b/plugins/gvm/_gvm new file mode 100644 index 000000000..10b5cadb2 --- /dev/null +++ b/plugins/gvm/_gvm @@ -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 diff --git a/plugins/gvm/gvm.plugin.zsh b/plugins/gvm/gvm.plugin.zsh new file mode 100644 index 000000000..f148fa0d1 --- /dev/null +++ b/plugins/gvm/gvm.plugin.zsh @@ -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"