mirror of https://github.com/tmux-plugins/tpm
parent
9251451554
commit
2d5ecdbe4a
@ -0,0 +1,44 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
||||
|
||||
source "$CURRENT_DIR/shared_functions.sh" |
||||
|
||||
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_message "Removing \"$plugin\"" |
||||
rm -rf "${plugin_directory}" |
||||
[ -d "${plugin_directory}" ] && |
||||
echo_message " \"$plugin\" clean fail" || |
||||
echo_message " \"$plugin\" clean success" |
||||
;; |
||||
esac |
||||
done |
||||
} |
||||
|
||||
ensure_tpm_path_exists() { |
||||
mkdir -p "$SHARED_TPM_PATH" |
||||
} |
||||
|
||||
reload_tmux_environment() { |
||||
tmux source-file ~/.tmux.conf >/dev/null 2>&1 |
||||
} |
||||
|
||||
main() { |
||||
reload_tmux_environment |
||||
shared_set_tpm_path_constant |
||||
ensure_tpm_path_exists |
||||
clean_plugins |
||||
reload_tmux_environment |
||||
end_message |
||||
} |
||||
main |
@ -0,0 +1,32 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
||||
|
||||
source "$CURRENT_DIR"/helpers.sh |
||||
|
||||
manually_install_the_plugin() { |
||||
rm -rf ~/.tmux/plugins/ |
||||
mkdir -p ~/.tmux/plugins/ |
||||
cd ~/.tmux/plugins/ |
||||
git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin |
||||
} |
||||
|
||||
test_plugin_installation() { |
||||
set_tmux_conf_helper <<- HERE |
||||
run-shell "$PWD/tpm" |
||||
HERE |
||||
|
||||
manually_install_the_plugin |
||||
|
||||
# opens tmux and test it with `expect` |
||||
"$CURRENT_DIR"/expect_successful_clean_plugins || |
||||
fail_helper "Clean fails" |
||||
|
||||
teardown_helper |
||||
} |
||||
|
||||
main() { |
||||
test_plugin_installation |
||||
exit_value_helper |
||||
} |
||||
main |
Loading…
Reference in new issue