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