mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
3c3f0e67f6
Rename custom scripts for `plugin-add` and `plugin-remove` phases in plugins to make clear when they are executed: `plugin-add` -> `post-plugin-add` `plugin-remove` -> `pre-plugin-remove`
30 lines
769 B
Bash
30 lines
769 B
Bash
# -*- sh -*-
|
|
|
|
plugin_remove_command() {
|
|
local plugin_name=$1
|
|
check_if_plugin_exists "$plugin_name"
|
|
|
|
local plugin_path
|
|
plugin_path=$(get_plugin_path "$plugin_name")
|
|
|
|
asdf_run_hook "pre_asdf_plugin_remove" "$plugin_name"
|
|
asdf_run_hook "pre_asdf_plugin_remove_${plugin_name}"
|
|
|
|
if [ -f "${plugin_path}/bin/pre-plugin-remove" ]; then
|
|
(
|
|
export ASDF_PLUGIN_PATH=$plugin_path
|
|
bash "${plugin_path}/bin/pre-plugin-remove"
|
|
)
|
|
fi
|
|
|
|
rm -rf "$plugin_path"
|
|
rm -rf "$(asdf_data_dir)/installs/${plugin_name}"
|
|
|
|
grep -l "asdf-plugin: ${plugin_name}" "$(asdf_data_dir)"/shims/* 2>/dev/null | xargs rm -f
|
|
|
|
asdf_run_hook "post_asdf_plugin_remove" "$plugin_name"
|
|
asdf_run_hook "post_asdf_plugin_remove_${plugin_name}"
|
|
}
|
|
|
|
plugin_remove_command "$@"
|