Skip to content

Commit 337b335

Browse files
duijfDaniel Perez
authored andcommitted
Check if plugin exists before removing it (asdf-vm#77)
Check if plugin exists before removing it
1 parent e962639 commit 337b335

File tree

15 files changed

+71
-18
lines changed

15 files changed

+71
-18
lines changed

bin/private/asdf-exec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugin_name=$1
66
executable_path=$2
77

88
plugin_path=$(get_plugin_path $plugin_name)
9-
check_if_plugin_exists $plugin_path
9+
check_if_plugin_exists $plugin_name
1010

1111
full_version=$(get_preset_version_for $plugin_name)
1212

lib/commands/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ install_tool_version() {
4646
local plugin_name=$1
4747
local full_version=$2
4848
local plugin_path=$(get_plugin_path $plugin_name)
49-
check_if_plugin_exists $plugin_path
49+
check_if_plugin_exists $plugin_name
5050

5151

5252
IFS=':' read -a version_info <<< "$full_version"

lib/commands/list-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
list_all_command() {
22
local plugin_name=$1
33
local plugin_path=$(get_plugin_path $plugin_name)
4-
check_if_plugin_exists $plugin_path
4+
check_if_plugin_exists $plugin_name
55

66
local versions=$(bash ${plugin_path}/bin/list-all)
77

lib/commands/list.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
list_command() {
22
local plugin_name=$1
33
local plugin_path=$(get_plugin_path $plugin_name)
4-
check_if_plugin_exists $plugin_path
4+
check_if_plugin_exists $plugin_name
55

66
local plugin_installs_path=$(asdf_dir)/installs/${plugin_name}
77

lib/commands/plugin-push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugin_push_command() {
77
done
88
else
99
local plugin_path=$(get_plugin_path $plugin_name)
10-
check_if_plugin_exists $plugin_path
10+
check_if_plugin_exists $plugin_name
1111
echo "Pushing $plugin_name..."
1212
(cd $plugin_path; git push)
1313
fi

lib/commands/plugin-remove.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
plugin_remove_command() {
22
local plugin_name=$1
3+
check_if_plugin_exists $plugin_name
4+
35
local plugin_path=$(get_plugin_path $plugin_name)
46

57
rm -rf $plugin_path

lib/commands/plugin-update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugin_update_command() {
1212
done
1313
else
1414
local plugin_path=$(get_plugin_path $plugin_name)
15-
check_if_plugin_exists $plugin_path
15+
check_if_plugin_exists $plugin_name
1616
echo "Updating $plugin_name..."
1717
(cd $plugin_path; git pull)
1818
fi

lib/commands/reshim.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ shim_command() {
22
local plugin_name=$1
33
local executable_path=$2
44
local plugin_path=$(get_plugin_path $plugin_name)
5-
check_if_plugin_exists $plugin_path
5+
check_if_plugin_exists $plugin_name
66
ensure_shims_dir
77

88
generate_shim_for_executable $plugin_name $executable_path
@@ -12,7 +12,7 @@ reshim_command() {
1212
local plugin_name=$1
1313
local full_version=$2
1414
local plugin_path=$(get_plugin_path $plugin_name)
15-
check_if_plugin_exists $plugin_path
15+
check_if_plugin_exists $plugin_name
1616
ensure_shims_dir
1717

1818
if [ "$full_version" != "" ]; then
@@ -62,7 +62,7 @@ generate_shim_for_executable() {
6262
local executable=$2
6363
local plugin_path=$(get_plugin_path $plugin_name)
6464

65-
check_if_plugin_exists $plugin_path
65+
check_if_plugin_exists $plugin_name
6666

6767
IFS=':' read -a version_info <<< "$full_version"
6868
if [ "${version_info[0]}" = "ref" ]; then
@@ -81,7 +81,7 @@ generate_shims_for_version() {
8181
local plugin_name=$1
8282
local full_version=$2
8383
local plugin_path=$(get_plugin_path $plugin_name)
84-
check_if_plugin_exists $plugin_path
84+
check_if_plugin_exists $plugin_name
8585

8686
IFS=':' read -a version_info <<< "$full_version"
8787
if [ "${version_info[0]}" = "ref" ]; then

lib/commands/uninstall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uninstall_command() {
33
local full_version=$2
44
local plugin_path=$(get_plugin_path $plugin_name)
55

6-
check_if_plugin_exists $plugin_path
6+
check_if_plugin_exists $plugin_name
77

88
IFS=':' read -a version_info <<< "$full_version"
99
if [ "${version_info[0]}" = "ref" ]; then

lib/commands/version_commands.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ version_command() {
5353

5454
local plugin=$2
5555

56-
check_if_plugin_exists $(get_plugin_path $plugin)
56+
check_if_plugin_exists $plugin
5757

5858
if [ $# -eq 2 ]; then
5959
get_plugin_version $cmd $file $plugin

0 commit comments

Comments
 (0)