Skip to content

Commit 02f24df

Browse files
committed
Improve output of where command when system version is set
1 parent 96e0103 commit 02f24df

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/commands/where.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ where_command() {
3232
echo "$install_path"
3333
exit 0
3434
else
35-
echo "Version not installed"
36-
exit 1
35+
if [ "$version" = "system" ]; then
36+
echo "System version is selected"
37+
exit 1
38+
else
39+
echo "Version not installed"
40+
exit 1
41+
fi
3742
fi
3843
}

test/where_command.bats

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ function teardown() {
4949
[ "$output" = "Version not installed" ]
5050
}
5151

52+
@test "where should error when system version is set" {
53+
run asdf where 'dummy' 'system'
54+
[ "$status" -eq 1 ]
55+
[ "$output" = "System version is selected" ]
56+
}
57+
5258
@test "where should error when no current version selected and version not specified" {
5359
run asdf where 'dummy'
5460

0 commit comments

Comments
 (0)