mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Merge pull request #640 from asdf-vm/improve-export-shell
Fix asdf shell xx --unset for fish
This commit is contained in:
commit
f787b719ac
@ -19,7 +19,14 @@ shell_command() {
|
||||
local version_env_var="ASDF_${upcase_name}_VERSION"
|
||||
|
||||
if [ "$version" = "--unset" ]; then
|
||||
echo "unset $version_env_var"
|
||||
case "$asdf_shell" in
|
||||
fish)
|
||||
echo "set -e $version_env_var"
|
||||
;;
|
||||
*)
|
||||
echo "unset $version_env_var"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
fi
|
||||
if ! (check_if_version_exists "$plugin" "$version"); then
|
||||
|
@ -282,3 +282,15 @@ teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "set -gx ASDF_DUMMY_VERSION \"1.1.0\"" ]
|
||||
}
|
||||
|
||||
@test "export-shell-version should unset when --unset flag is passed" {
|
||||
run asdf export-shell-version sh "dummy" "--unset"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "unset ASDF_DUMMY_VERSION" ]
|
||||
}
|
||||
|
||||
@test "export-shell-version should use set -e when --unset flag is passed and shell is fish" {
|
||||
run asdf export-shell-version fish "dummy" "--unset"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "set -e ASDF_DUMMY_VERSION" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user