mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
Merge pull request #26 from meatballhat/allow-in-session-path-changes
Allow for in-session changes to $PATH
This commit is contained in:
Vendored
+2
-2
@@ -20,7 +20,7 @@ function gvm_pkgset_use() {
|
||||
[[ "$2" != "--default" ]] ||
|
||||
display_error "Cannot set local pkgset as default" || return 1
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
gvm_export_path
|
||||
. "$LOCAL_TOP/environments/$fuzzy_match" ||
|
||||
display_error "Failed to source the package set environment" || return 1
|
||||
|
||||
@@ -30,7 +30,7 @@ function gvm_pkgset_use() {
|
||||
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_export_path
|
||||
. "$GVM_ROOT/environments/$fuzzy_match" ||
|
||||
display_error "Failed to source the package set environment" || return 1
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ function gvm_use() {
|
||||
fi
|
||||
fi
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
gvm_export_path
|
||||
. $GVM_ROOT/environments/$fuzzy_match &> /dev/null || display_error "Couldn't source environment" || return 1
|
||||
if [[ "$2" == "--default" ]]; then
|
||||
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default || display_error "Couldn't make $fuzzy_match default"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
function gvm_export_path() {
|
||||
export PATH="$GVM_ROOT/bin:`echo "$PATH" | tr ":" "\n" | grep -v '^$' | egrep -v "$GVM_ROOT/(pkgsets|gos|bin)" | tr "\n" ":" | sed 's/:*$//'`"
|
||||
export GVM_PATH_BACKUP="$PATH"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user