fix(tmux-projectinator): Rework option menu

This commit is contained in:
Tanguy Herbron 2024-01-02 20:02:41 +01:00
parent 8e6a1abf26
commit 207a119f0d

View File

@ -6,17 +6,6 @@ bind '"\e": "\C-W\c-d"'
OPEN_MODE="new_pane" OPEN_MODE="new_pane"
while getopts ":l:v" option; do
case $option in
l)
OPEN_MODE="local"
;;
v)
VERBOSE=true
;;
esac
done
debug () { debug () {
if [ "$VERBOSE" = true ]; then if [ "$VERBOSE" = true ]; then
echo $1 echo $1
@ -59,6 +48,18 @@ open_new_pane () {
tmux display-popup -C tmux display-popup -C
} }
while getopts "lv" option; do
debug "Reading option $option"
case $option in
l)
OPEN_MODE="local"
;;
v)
VERBOSE=true
;;
esac
done
declare -A CUSTOM_SESSIONS declare -A CUSTOM_SESSIONS
CUSTOM_SESSIONS[Projects]=Halia CUSTOM_SESSIONS[Projects]=Halia
@ -80,6 +81,7 @@ PROJECT_NAME=$(echo $SELECTED | rev | cut -d '/' -f1 | rev)
SESSION_NAME=$([ -z "${CUSTOM_SESSIONS[$PROJECT_ROOT]}" ] && echo "$PROJECT_ROOT" || echo "${CUSTOM_SESSIONS[$PROJECT_ROOT]}") SESSION_NAME=$([ -z "${CUSTOM_SESSIONS[$PROJECT_ROOT]}" ] && echo "$PROJECT_ROOT" || echo "${CUSTOM_SESSIONS[$PROJECT_ROOT]}")
debug "Project path is $PROJECT_PATH" debug "Project path is $PROJECT_PATH"
debug "Opening in $OPEN_MODE"
case $OPEN_MODE in case $OPEN_MODE in
"new_pane") "new_pane")