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

Commit

Permalink
Global set for fish env
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Roman Coedo committed Nov 18, 2015
1 parent b00e30c commit f81870e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion commands/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func set(c CommandLine) error {

switch userShell {
case "fish":
shellCfg.Prefix = "set -x "
shellCfg.Prefix = "set -gx "
shellCfg.Suffix = "\";\n"
shellCfg.Delimiter = " \""
case "powershell":
Expand Down
10 changes: 5 additions & 5 deletions test/integration/core/env_shell.bats
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ load ${BASE_TEST_DIR}/helpers.bash

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

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

0 comments on commit f81870e

Please sign in to comment.