From 36c7024baa4b829b3629b4e0430157266d354158 Mon Sep 17 00:00:00 2001 From: Edvard <75655486+edvardsanta@users.noreply.github.com> Date: Sun, 10 Sep 2023 11:43:39 -0300 Subject: [PATCH] feat: add plugin location when update the plugin (#1602) --- lib/functions/plugins.bash | 1 + test/plugin_update_command.bats | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/functions/plugins.bash b/lib/functions/plugins.bash index e38d4e61..3b36ddd9 100644 --- a/lib/functions/plugins.bash +++ b/lib/functions/plugins.bash @@ -140,6 +140,7 @@ update_plugin() { local prev_ref= local post_ref= { + printf "Location of %s plugin: %s\n" "$plugin_name" "$plugin_path" asdf_run_hook "pre_asdf_plugin_update" "$plugin_name" asdf_run_hook "pre_asdf_plugin_update_${plugin_name}" diff --git a/test/plugin_update_command.bats b/test/plugin_update_command.bats index e8ce1b0f..9bde04c8 100644 --- a/test/plugin_update_command.bats +++ b/test/plugin_update_command.bats @@ -169,7 +169,7 @@ EOM new_ref="$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" rev-parse --short HEAD)" local expected_output="plugin updated path=${plugin_path} old git-ref=${old_ref} new git-ref=${new_ref}" - [[ "$output" = "UPDATE dummy"*"${expected_output}" ]] + [[ "$output" = *"UPDATE dummy"*"${expected_output}" ]] } @test "asdf plugin-update executes configured pre hook (specific)" { @@ -185,7 +185,7 @@ EOM new_ref="$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" rev-parse --short HEAD)" local expected_output="plugin updated path=${plugin_path} old git-ref=${old_ref} new git-ref=${new_ref}" - [[ "$output" = "UPDATE"*"${expected_output}" ]] + [[ "$output" = *"UPDATE"*"${expected_output}" ]] } @test "asdf plugin-update executes configured post hook (generic)" { @@ -221,3 +221,12 @@ EOM UPDATE" [[ "$output" = *"${expected_output}" ]] } + +@test "asdf plugin-update prints the location of plugin (specific)" { + local plugin_path + plugin_path="$(get_plugin_path dummy)" + run asdf plugin-update dummy + + local expected_output="Location of dummy plugin: $plugin_path" + [[ "$output" == *"$expected_output"* ]] +}