tpm/scripts/clean_plugins.sh

42 lines
1022 B
Bash
Raw Normal View History

2015-05-27 03:46:15 +00:00
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2015-08-03 13:12:45 +00:00
HELPERS_DIR="$CURRENT_DIR/helpers"
2015-05-27 03:46:15 +00:00
source "$CURRENT_DIR/shared_functions.sh"
2015-08-03 13:12:45 +00: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-27 03:46:15 +00:00
clean_plugins() {
local plugins plugin plugin_directory
plugins="$(shared_get_tpm_plugins_list)"
for plugin_directory in "$SHARED_TPM_PATH"/*; do
[ -d "${plugin_directory}" ] || continue
plugin="$(shared_plugin_name "${plugin_directory}")"
case "${plugins}" in
*"${plugin}"*) : ;;
*)
[ "${plugin}" = "tpm" ] && continue
echo_ok "Removing \"$plugin\""
rm -rf "${plugin_directory}" >/dev/null 2>&1
2015-05-27 03:46:15 +00:00
[ -d "${plugin_directory}" ] &&
echo_err " \"$plugin\" clean fail" ||
echo_ok " \"$plugin\" clean success"
2015-05-27 03:46:15 +00:00
;;
esac
done
}
main() {
shared_set_tpm_path_constant
ensure_tpm_path_exists
clean_plugins
exit_value_helper
2015-05-27 03:46:15 +00:00
}
main