2019-11-27 01:24:29 -07:00
|
|
|
# -*- sh -*-
|
|
|
|
|
2015-05-17 11:20:51 -07:00
|
|
|
plugin_remove_command() {
|
2015-05-26 23:46:17 -07:00
|
|
|
local plugin_name=$1
|
2017-09-04 10:04:56 -07:00
|
|
|
check_if_plugin_exists "$plugin_name"
|
2016-07-05 16:19:15 -07:00
|
|
|
|
2017-09-04 10:04:56 -07:00
|
|
|
local plugin_path
|
|
|
|
plugin_path=$(get_plugin_path "$plugin_name")
|
2015-05-17 11:20:51 -07:00
|
|
|
|
2020-03-21 06:59:33 -07:00
|
|
|
asdf_run_hook "pre_asdf_plugin_remove" "$plugin_name"
|
|
|
|
asdf_run_hook "pre_asdf_plugin_remove_${plugin_name}"
|
|
|
|
|
2020-03-21 18:57:54 -07:00
|
|
|
if [ -f "${plugin_path}/bin/pre-plugin-remove" ]; then
|
2020-03-21 06:59:33 -07:00
|
|
|
(
|
|
|
|
export ASDF_PLUGIN_PATH=$plugin_path
|
2021-07-29 15:44:14 -07:00
|
|
|
"${plugin_path}/bin/pre-plugin-remove"
|
2020-03-21 06:59:33 -07:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2017-09-04 10:04:56 -07:00
|
|
|
rm -rf "$plugin_path"
|
2018-06-10 01:54:39 -07:00
|
|
|
rm -rf "$(asdf_data_dir)/installs/${plugin_name}"
|
2020-05-14 06:11:20 -07:00
|
|
|
rm -rf "$(asdf_data_dir)/downloads/${plugin_name}"
|
2016-12-10 12:54:22 -07:00
|
|
|
|
2023-03-24 05:37:23 -07:00
|
|
|
for f in "$(asdf_data_dir)"/shims/*; do
|
2023-04-16 21:51:06 -07:00
|
|
|
if [ -f "$f" ]; then # nullglob may not be set
|
|
|
|
if grep -q "asdf-plugin: ${plugin_name}" "$f"; then
|
|
|
|
rm -f "$f"
|
|
|
|
fi
|
2023-03-24 05:37:23 -07:00
|
|
|
fi
|
|
|
|
done
|
2020-03-21 06:59:33 -07:00
|
|
|
|
|
|
|
asdf_run_hook "post_asdf_plugin_remove" "$plugin_name"
|
|
|
|
asdf_run_hook "post_asdf_plugin_remove_${plugin_name}"
|
2015-05-17 11:20:51 -07:00
|
|
|
}
|
2019-11-27 01:24:29 -07:00
|
|
|
|
|
|
|
plugin_remove_command "$@"
|