function display_error() { tput sgr0 tput setaf 1 echo "ERROR: $1" >&2 tput sgr0 return 1 } function display_message() { # GREEN! tput sgr0 tput setaf 2 echo "$1" tput sgr0 } function gvm_pkgset_use() { [[ "$1" != "" ]] || display_error "Please specify a package set" || return 1 [[ "$gvm_go_name" != "" ]] || display_error "No Go version selected" || return 1 fuzzy_match=`ls $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | grep "$1" | head -n 1` || display_error "Invalid package set" || return 1 . "$GVM_ROOT/environments/$fuzzy_match" || display_error "Failed to source the package set environment" || return 1 if [[ "$2" == "--default" ]]; then cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default fi echo "Now using version $fuzzy_match" }