mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Merge pull request #315 from mxie/mx-include-plugin-name-in-error-output
Include plugin name in error message if plugin doesn't exist
This commit is contained in:
commit
b3408a0eaf
@ -54,14 +54,16 @@ list_installed_versions() {
|
||||
}
|
||||
|
||||
check_if_plugin_exists() {
|
||||
local plugin_name=$1
|
||||
|
||||
# Check if we have a non-empty argument
|
||||
if [ -z "${1}" ]; then
|
||||
display_error "No plugin given"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$(asdf_dir)/plugins/$1" ]; then
|
||||
display_error "No such plugin"
|
||||
if [ ! -d "$(asdf_dir)/plugins/$plugin_name" ]; then
|
||||
display_error "No such plugin: $plugin_name"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ teardown() {
|
||||
@test "current should error when the plugin doesn't exist" {
|
||||
run current_command "foobar"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "No such plugin" ]
|
||||
[ "$output" = "No such plugin: foobar" ]
|
||||
}
|
||||
|
||||
@test "current should error when no version is set" {
|
||||
|
@ -31,7 +31,7 @@ teardown() {
|
||||
@test "plugin_remove_command should exit with 1 when passed invalid plugin name" {
|
||||
run plugin_remove_command "does-not-exist"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "No such plugin" ]
|
||||
[ "$output" = "No such plugin: does-not-exist" ]
|
||||
}
|
||||
|
||||
@test "plugin_remove_command should remove installed versions" {
|
||||
|
@ -19,7 +19,7 @@ teardown() {
|
||||
@test "check_if_version_exists should exit with 1 if plugin does not exist" {
|
||||
run check_if_version_exists "inexistent" "1.0.0"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "No such plugin" ]
|
||||
[ "$output" = "No such plugin: inexistent" ]
|
||||
}
|
||||
|
||||
@test "check_if_version_exists should exit with 1 if version does not exist" {
|
||||
|
@ -30,7 +30,7 @@ teardown() {
|
||||
@test "local should emit an error when plugin does not exist" {
|
||||
run local_command "inexistent" "1.0.0"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "No such plugin" ]
|
||||
[ "$output" = "No such plugin: inexistent" ]
|
||||
}
|
||||
|
||||
@test "local should emit an error when plugin version does not exist" {
|
||||
|
@ -43,5 +43,5 @@ teardown() {
|
||||
@test "which should error when the plugin doesn't exist" {
|
||||
run which_command "foobar"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "No such plugin" ]
|
||||
[ "$output" = "No such plugin: foobar" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user