1
0
Fork 0
mirror of synced 2024-11-14 05:28:58 -05:00
tpm/scripts/clean_plugins.sh

42 lines
1,016 B
Bash
Raw Normal View History

2015-05-26 23:46:15 -04:00
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2015-08-03 09:12:45 -04:00
HELPERS_DIR="$CURRENT_DIR/helpers"
2015-05-26 23:46:15 -04:00
2015-08-03 11:40:50 -04:00
source "$HELPERS_DIR/plugin_functions.sh"
source "$HELPERS_DIR/utility.sh"
2015-05-26 23:46:15 -04:00
2015-08-03 09:12:45 -04:00
if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions
source "$HELPERS_DIR/tmux_echo_functions.sh"
else # shell output functions
source "$HELPERS_DIR/shell_echo_functions.sh"
fi
2015-05-26 23:46:15 -04:00
clean_plugins() {
local plugins plugin plugin_directory
2015-08-03 11:40:50 -04:00
plugins="$(tpm_plugins_list_helper)"
2015-05-26 23:46:15 -04:00
for plugin_directory in "$(tpm_path)"/*; do
2015-05-26 23:46:15 -04:00
[ -d "${plugin_directory}" ] || continue
2015-08-03 11:40:50 -04:00
plugin="$(plugin_name_helper "${plugin_directory}")"
2015-05-26 23:46:15 -04:00
case "${plugins}" in
*"${plugin}"*) : ;;
*)
[ "${plugin}" = "tpm" ] && continue
echo_ok "Removing \"$plugin\""
rm -rf "${plugin_directory}" >/dev/null 2>&1
2015-05-26 23:46:15 -04:00
[ -d "${plugin_directory}" ] &&
echo_err " \"$plugin\" clean fail" ||
echo_ok " \"$plugin\" clean success"
2015-05-26 23:46:15 -04:00
;;
esac
done
}
main() {
ensure_tpm_path_exists
clean_plugins
exit_value_helper
2015-05-26 23:46:15 -04:00
}
main