#!/bin/bash
if [ -z "$GVM_ROOT" ]; then
	tput sgr0
	tput setaf 1
	echo 'ERROR: $GVM_ROOT is not set! Please add the following line to your .bashrc or .profile

	[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
' >&2
	tput sgr0
	exit 1
fi

. $GVM_ROOT/scripts/functions

command=$1
if [[ $command == "implode" ]]; then
	rm -rf $GVM_ROOT
	exit 0
fi

$GVM_ROOT/scripts/gvm-check
if [[ "$?" != "0" ]]; then
	display_error "Missing requirements. Please see messages above"
fi

if [[ $command == "version" ]]; then
	display_message "Go Version Manager v$GVM_VERSION"
else
	if [ -f $GVM_ROOT/scripts/$command ]; then
		shift
		$GVM_ROOT/scripts/$command $@
	elif [[ -n $command ]]; then
		display_error "Unrecognized command line argument: '$command'"
	else
		echo "= gvm

* http://github.com/moovweb/gvm

== DESCRIPTION:

GVM is the Go Version Manager

== Usage

  gvm Command

== Command

  version    - print the gvm version number
  get        - gets the latest code (for debugging)
  use        - select a go version to use
  implode    - completely remove gvm
  install    - install go versions
  uninstall  - uninstall go versions
  list       - list installed go versions
  pkgset     - manage go packages sets
  pkg        - manage go packages"
	fi
fi
