Merge pull request #26 from meatballhat/allow-in-session-path-changes

Allow for in-session changes to $PATH
This commit is contained in:
jbussdieker
2013-06-20 06:52:59 -07:00
3 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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"
+6
View File
@@ -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"
}