Skip to content
This repository was archived by the owner on Sep 26, 2021. It is now read-only.

Commit f81870e

Browse files
committed
Global set for fish env
Using "set -x" only exports the variable in the local scope. This is a limitation when an user needs to invoke "docker-machine" in a fish script. Using "set -gx" instead exports the variable globally. Signed-off-by: Roman Coedo <[email protected]>
1 parent b00e30c commit f81870e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

commands/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func set(c CommandLine) error {
9898

9999
switch userShell {
100100
case "fish":
101-
shellCfg.Prefix = "set -x "
101+
shellCfg.Prefix = "set -gx "
102102
shellCfg.Suffix = "\";\n"
103103
shellCfg.Delimiter = " \""
104104
case "powershell":

test/integration/core/env_shell.bats

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ load ${BASE_TEST_DIR}/helpers.bash
4444

4545
@test "$DRIVER: test fish notation" {
4646
run machine env --shell fish --no-proxy $NAME
47-
[[ ${lines[0]} == "set -x DOCKER_TLS_VERIFY \"1\";" ]]
48-
[[ ${lines[1]} == "set -x DOCKER_HOST \"$(machine url $NAME)\";" ]]
49-
[[ ${lines[2]} == "set -x DOCKER_CERT_PATH \"$MACHINE_STORAGE_PATH/machines/$NAME\";" ]]
50-
[[ ${lines[3]} == "set -x DOCKER_MACHINE_NAME \"$NAME\";" ]]
51-
[[ ${lines[4]} == "set -x NO_PROXY \"$(machine ip $NAME)\";" ]]
47+
[[ ${lines[0]} == "set -gx DOCKER_TLS_VERIFY \"1\";" ]]
48+
[[ ${lines[1]} == "set -gx DOCKER_HOST \"$(machine url $NAME)\";" ]]
49+
[[ ${lines[2]} == "set -gx DOCKER_CERT_PATH \"$MACHINE_STORAGE_PATH/machines/$NAME\";" ]]
50+
[[ ${lines[3]} == "set -gx DOCKER_MACHINE_NAME \"$NAME\";" ]]
51+
[[ ${lines[4]} == "set -gx NO_PROXY \"$(machine ip $NAME)\";" ]]
5252
}
5353

5454
@test "$DRIVER: test no proxy with NO_PROXY already set" {

0 commit comments

Comments
 (0)