asdf/lib/commands/command-plugin-remove.bash

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
917 B
Bash
Raw Normal View History

# -*- sh -*-
2015-05-17 11:20:51 -07:00
plugin_remove_command() {
local plugin_name=$1
2017-09-04 10:04:56 -07:00
check_if_plugin_exists "$plugin_name"
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
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
"${plugin_path}/bin/pre-plugin-remove"
)
fi
2017-09-04 10:04:56 -07:00
rm -rf "$plugin_path"
rm -rf "$(asdf_data_dir)/installs/${plugin_name}"
rm -rf "$(asdf_data_dir)/downloads/${plugin_name}"
for f in "$(asdf_data_dir)"/shims/*; do
if [ -f "$f" ]; then # nullglob may not be set
if grep -q "asdf-plugin: ${plugin_name}" "$f"; then
rm -f "$f"
fi
fi
done
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
}
plugin_remove_command "$@"