From 47c7679e42ebc1593cde32f9c57269bfb2db3b75 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Fri, 14 Jul 2023 15:53:37 -0700 Subject: [PATCH] fix: Exit success when adding an already-added plugin --- lib/functions/plugins.bash | 4 ++-- test/plugin_add_command.bats | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/functions/plugins.bash b/lib/functions/plugins.bash index 247a22dfc..1551707c7 100644 --- a/lib/functions/plugins.bash +++ b/lib/functions/plugins.bash @@ -79,8 +79,8 @@ plugin_add_command() { mkdir -p "$(asdf_data_dir)/plugins" if [ -d "$plugin_path" ]; then - display_error "Plugin named $plugin_name already added" - exit 2 + printf '%s\n' "Plugin named $plugin_name already added" + exit 0 else asdf_run_hook "pre_asdf_plugin_add" "$plugin_name" asdf_run_hook "pre_asdf_plugin_add_${plugin_name}" diff --git a/test/plugin_add_command.bats b/test/plugin_add_command.bats index f5f42fa9b..fa0348133 100644 --- a/test/plugin_add_command.bats +++ b/test/plugin_add_command.bats @@ -97,12 +97,12 @@ teardown() { [ "$output" = "dummy" ] } -@test "plugin_add command with URL specified run twice returns error second time" { +@test "plugin_add command with URL specified twice returns success on second time" { install_mock_plugin_repo "dummy" run asdf plugin add "dummy" "${BASE_DIR}/repo-dummy" run asdf plugin add "dummy" "${BASE_DIR}/repo-dummy" - [ "$status" -eq 2 ] + [ "$status" -eq 0 ] [ "$output" = "Plugin named dummy already added" ] }