mirror of
https://github.com/tmux-plugins/tpm.git
synced 2024-12-04 18:58:49 +00:00
Refactor how TPM path is set
This commit is contained in:
parent
cd97b4bceb
commit
0f0d9adb06
@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
|
||||
tpm_path_set() {
|
||||
tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME"
|
||||
}
|
||||
|
||||
set_default_tpm_path() {
|
||||
tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$DEFAULT_TPM_PATH"
|
||||
}
|
||||
|
||||
main() {
|
||||
if ! tpm_path_set; then
|
||||
set_default_tpm_path
|
||||
fi
|
||||
}
|
||||
main
|
@ -54,7 +54,7 @@ test_default_tpm_path() {
|
||||
run-shell "$TPM_DIR/tpm"
|
||||
HERE
|
||||
|
||||
check_tpm_path "$PLUGINS_DIR" ||
|
||||
check_tpm_path "${PLUGINS_DIR}/" ||
|
||||
fail_helper "Default TPM path not correct"
|
||||
|
||||
teardown_helper
|
||||
|
14
tpm
14
tpm
@ -7,14 +7,22 @@ SCRIPTS_DIR="$CURRENT_DIR/scripts"
|
||||
source "$SCRIPTS_DIR/variables.sh"
|
||||
source "$SCRIPTS_DIR/helpers.sh"
|
||||
|
||||
tpm_path_set() {
|
||||
tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
set_default_tpm_path() {
|
||||
tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$DEFAULT_TPM_PATH"
|
||||
}
|
||||
|
||||
# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set.
|
||||
# Default tpm path is "$HOME/.tmux/plugins/". That's where all the plugins are
|
||||
# downloaded.
|
||||
#
|
||||
# Put this in `.tmux.conf` to override the default:
|
||||
# `set-environment -g TMUX_PLUGIN_MANAGER_PATH "/some/other/path/"`
|
||||
set_tpm_path() {
|
||||
"$SCRIPTS_DIR/set_tpm_path.sh" >/dev/null 2>&1
|
||||
if ! tpm_path_set; then
|
||||
set_default_tpm_path
|
||||
fi
|
||||
}
|
||||
|
||||
# 1. Fetches plugin names from `@plugin` variables
|
||||
|
Loading…
Reference in New Issue
Block a user