mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 21:05:52 +10:00
in the source environment. Also catch tool errors in the gvm script and function.
23 lines
691 B
Bash
23 lines
691 B
Bash
#!/bin/bash
|
|
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_PATH $GVM_ROOT/environments | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "$1" | $HEAD_PATH -n 1` ||
|
|
display_error "Invalid package set" || return 1
|
|
|
|
export PATH=$GVM_PATH_BACKUP
|
|
. "$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"
|
|
}
|
|
|