Skip to content

Commit 2d48c0c

Browse files
authored
Merge pull request #28 from Tamrin007/fix-fish-init
Prefer 'set' command to 'setenv' function for fish shell
2 parents c80f80f + 8ee85d8 commit 2d48c0c

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

libexec/goenv-init

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ mkdir -p "${GOENV_ROOT}/"{shims,versions}
8686

8787
case "$shell" in
8888
fish )
89-
echo "setenv PATH '${GOENV_ROOT}/shims' \$PATH"
90-
echo "setenv GOENV_SHELL $shell"
91-
echo "setenv GOROOT (goenv prefix)"
89+
echo "set -gx PATH '${GOENV_ROOT}/shims' \$PATH"
90+
echo "set -gx GOENV_SHELL $shell"
91+
echo "set -gx GOROOT (goenv prefix)"
9292
;;
9393
* )
9494
echo 'export PATH="'${GOENV_ROOT}'/shims:${PATH}"'

libexec/goenv-sh-shell

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if goenv-prefix "${versions[@]}" >/dev/null; then
5555
IFS="$OLDIFS"
5656
case "$shell" in
5757
fish )
58-
echo "setenv GOENV_VERSION \"${version}\""
58+
echo "set -gx GOENV_VERSION \"${version}\""
5959
;;
6060
* )
6161
echo "export GOENV_VERSION=\"${version}\""

test/init.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ OUT
7373
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin:/usr/local/bin"
7474
run goenv-init - fish
7575
assert_success
76-
assert_line 0 "setenv PATH '${GOENV_ROOT}/shims' \$PATH"
76+
assert_line 0 "set -gx PATH '${GOENV_ROOT}/shims' \$PATH"
7777
}
7878

7979
@test "can add shims to PATH more than once" {
@@ -87,7 +87,7 @@ OUT
8787
export PATH="${GOENV_ROOT}/shims:$PATH"
8888
run goenv-init - fish
8989
assert_success
90-
assert_line 0 "setenv PATH '${GOENV_ROOT}/shims' \$PATH"
90+
assert_line 0 "set -gx PATH '${GOENV_ROOT}/shims' \$PATH"
9191
}
9292

9393
@test "outputs sh-compatible syntax" {

test/shell.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ SH
4848
@test "shell change version (fish)" {
4949
mkdir -p "${GOENV_ROOT}/versions/1.2.3"
5050
GOENV_SHELL=fish run goenv-sh-shell 1.2.3
51-
assert_success 'setenv GOENV_VERSION "1.2.3"'
51+
assert_success 'set -gx GOENV_VERSION "1.2.3"'
5252
}

0 commit comments

Comments
 (0)