Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: exit success when adding an already-added plugin #1598

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/functions/plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions test/plugin_add_command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}

Expand Down