Skip to content
This repository was archived by the owner on May 11, 2022. It is now read-only.

Commit 1f25280

Browse files
committed
improve activate script
1 parent 7041ba0 commit 1f25280

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bin/activate

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ deactivate () {
1313

1414
if [[ ! "$1" = "nondestructive" ]] ; then
1515
unset -f deactivate
16+
unset -f realpath
1617
unset -f get
1718
unset -f up
1819
fi
1920
}
2021

22+
realpath () {
23+
if [[ -z "${1:-}" ]]; then
24+
echo 'Please provide a file/dir name'
25+
return
26+
fi
27+
echo "$(cd `dirname ${1}` && pwd)/${1}"
28+
}
29+
2130
get () {
2231
go get -mod= $@
2332
}
@@ -30,7 +39,7 @@ up () {
3039
deactivate nondestructive
3140

3241
_OLD_PATH="${PATH}"
33-
export PATH="$(cd `dirname ${0}` && pwd):${PATH}"
42+
export PATH="$(realpath $(dirname $0)):${PATH}"
3443
export VAULT_ADDR=http://127.0.0.1:8200
3544

3645
if [[ -n "${BASH:-}" || -n "${ZSH_VERSION:-}" ]] ; then

0 commit comments

Comments
 (0)