mirror of
https://github.com/tmux-plugins/tpm.git
synced 2025-09-14 00:46:56 +00:00
Enable removing plugins via CLI executable
This commit is contained in:
@ -4,6 +4,33 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/shared_functions.sh"
|
||||
|
||||
TMUX_ECHO_FLAG="$1"
|
||||
|
||||
# True if invoked as tmux mapping or tmux command,
|
||||
# false if invoked via command line wrapper from `bin/` directory.
|
||||
use_tmux_echo() {
|
||||
[ "$TMUX_ECHO_FLAG" == "--tmux-echo" ]
|
||||
}
|
||||
|
||||
if use_tmux_echo; then
|
||||
# use tmux specific echo-ing
|
||||
echo_ok() {
|
||||
echo_message "$*"
|
||||
}
|
||||
|
||||
echo_err() {
|
||||
echo_message "$*"
|
||||
}
|
||||
else
|
||||
echo_ok() {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
echo_err() {
|
||||
fail_helper "$*"
|
||||
}
|
||||
fi
|
||||
|
||||
clean_plugins() {
|
||||
local plugins plugin plugin_directory
|
||||
plugins="$(shared_get_tpm_plugins_list)"
|
||||
@ -15,22 +42,20 @@ clean_plugins() {
|
||||
*"${plugin}"*) : ;;
|
||||
*)
|
||||
[ "${plugin}" = "tpm" ] && continue
|
||||
echo_message "Removing \"$plugin\""
|
||||
rm -rf "${plugin_directory}"
|
||||
echo_ok "Removing \"$plugin\""
|
||||
rm -rf "${plugin_directory}" >/dev/null 2>&1
|
||||
[ -d "${plugin_directory}" ] &&
|
||||
echo_message " \"$plugin\" clean fail" ||
|
||||
echo_message " \"$plugin\" clean success"
|
||||
echo_err " \"$plugin\" clean fail" ||
|
||||
echo_ok " \"$plugin\" clean success"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
reload_tmux_environment
|
||||
shared_set_tpm_path_constant
|
||||
ensure_tpm_path_exists
|
||||
clean_plugins
|
||||
reload_tmux_environment
|
||||
end_message
|
||||
exit_value_helper
|
||||
}
|
||||
main
|
||||
|
Reference in New Issue
Block a user