2015-05-17 00:46:56 -07:00
|
|
|
uninstall_command() {
|
2015-05-26 23:46:17 -07:00
|
|
|
local plugin_name=$1
|
2015-05-17 00:46:56 -07:00
|
|
|
local full_version=$2
|
2015-05-26 23:46:17 -07:00
|
|
|
local plugin_path=$(get_plugin_path $plugin_name)
|
2015-05-07 22:58:07 -07:00
|
|
|
|
2016-07-05 16:19:15 -07:00
|
|
|
check_if_plugin_exists $plugin_name
|
2015-05-07 22:58:07 -07:00
|
|
|
|
2015-05-17 00:46:56 -07:00
|
|
|
IFS=':' read -a version_info <<< "$full_version"
|
2015-05-21 21:47:27 -07:00
|
|
|
if [ "${version_info[0]}" = "ref" ]; then
|
2015-05-17 00:46:56 -07:00
|
|
|
local install_type="${version_info[0]}"
|
|
|
|
local version="${version_info[1]}"
|
|
|
|
else
|
|
|
|
local install_type="version"
|
|
|
|
local version="${version_info[0]}"
|
|
|
|
fi
|
2015-05-07 22:58:07 -07:00
|
|
|
|
2015-05-26 23:46:17 -07:00
|
|
|
local install_path=$(get_install_path $plugin_name $install_type $version)
|
2015-05-07 22:58:07 -07:00
|
|
|
|
2015-05-17 03:47:45 -07:00
|
|
|
if [ ! -d $install_path ]; then
|
2015-05-17 00:46:56 -07:00
|
|
|
display_error "No such version"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-05-16 21:28:14 -07:00
|
|
|
|
2015-05-17 11:20:51 -07:00
|
|
|
if [ -f ${plugin_path}/bin/uninstall ]; then
|
2015-05-21 22:17:44 -07:00
|
|
|
(
|
|
|
|
export ASDF_INSTALL_TYPE=$install_type
|
|
|
|
export ASDF_INSTALL_VERSION=$version
|
|
|
|
export ASDF_INSTALL_PATH=$install_path
|
|
|
|
bash ${plugin_path}/bin/uninstall
|
|
|
|
)
|
2015-05-17 00:46:56 -07:00
|
|
|
else
|
|
|
|
rm -rf $install_path
|
|
|
|
fi
|
|
|
|
}
|