fix(tmux-projectinator): Exit script correctly

This commit is contained in:
Tanguy Herbron 2024-01-13 16:04:45 +01:00
parent 0684b34a09
commit d647d36f10

View File

@ -7,6 +7,13 @@ bind '"\e": "\C-W\c-d"'
OPEN_MODE="new_pane"
CACHE_FILE=~/.cache/project_list
# Close tmux popup if any and quit
exit_script () {
tmux display-popup -C
exit $1
}
debug () {
if [ "$VERBOSE" = true ]; then
echo $1
@ -28,8 +35,7 @@ open_local () {
tmux send-keys C-c
tmux send-keys "cd $PROJECT_PATH" Enter
# Close tmux popup if any
tmux display-popup -C
exit_script 0
}
open_new_pane () {
@ -47,8 +53,7 @@ open_new_pane () {
tmux switch-client -t $SESSION_NAME:$PROJECT_NAME
# Close tmux popup if any
tmux display-popup -C
exit_script 0
}
update_project_list_cache() {
@ -93,7 +98,7 @@ debug "Selected $SELECTED"
# Quit if nothing has been selected
if [ ! $SELECTED ]; then
exit 0
exit_script 1
fi
PROJECT_PATH=$(realpath ~/${SELECTED})