refactor(tmux-projectinator): Re-indent filee
This commit is contained in:
parent
72c5886271
commit
0684b34a09
@ -8,9 +8,9 @@ OPEN_MODE="new_pane"
|
|||||||
CACHE_FILE=~/.cache/project_list
|
CACHE_FILE=~/.cache/project_list
|
||||||
|
|
||||||
debug () {
|
debug () {
|
||||||
if [ "$VERBOSE" = true ]; then
|
if [ "$VERBOSE" = true ]; then
|
||||||
echo $1
|
echo $1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
spinner() {
|
spinner() {
|
||||||
@ -24,31 +24,31 @@ spinner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open_local () {
|
open_local () {
|
||||||
# To avoid using pre-entered string in current buffer
|
# To avoid using pre-entered string in current buffer
|
||||||
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
|
# Close tmux popup if any
|
||||||
tmux display-popup -C
|
tmux display-popup -C
|
||||||
}
|
}
|
||||||
|
|
||||||
open_new_pane () {
|
open_new_pane () {
|
||||||
tmux has-session -t $SESSION_NAME 2>/dev/null
|
tmux has-session -t $SESSION_NAME 2>/dev/null
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
debug "Session $SESSION_NAME missing, creating it."
|
debug "Session $SESSION_NAME missing, creating it."
|
||||||
tmux new-session -s $SESSION_NAME -d -n $PROJECT_NAME -c $PROJECT_PATH
|
tmux new-session -s $SESSION_NAME -d -n $PROJECT_NAME -c $PROJECT_PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux has-session -t $SESSION_NAME:$PROJECT_NAME 2>/dev/null
|
tmux has-session -t $SESSION_NAME:$PROJECT_NAME 2>/dev/null
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
debug "Window $PROJECT_NAME in $SESSION_NAME not found, creating it."
|
debug "Window $PROJECT_NAME in $SESSION_NAME not found, creating it."
|
||||||
tmux new-window -t $SESSION_NAME -n $PROJECT_NAME -d -c $PROJECT_PATH
|
tmux new-window -t $SESSION_NAME -n $PROJECT_NAME -d -c $PROJECT_PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux switch-client -t $SESSION_NAME:$PROJECT_NAME
|
tmux switch-client -t $SESSION_NAME:$PROJECT_NAME
|
||||||
|
|
||||||
# Close tmux popup if any
|
# Close tmux popup if any
|
||||||
tmux display-popup -C
|
tmux display-popup -C
|
||||||
}
|
}
|
||||||
|
|
||||||
update_project_list_cache() {
|
update_project_list_cache() {
|
||||||
@ -58,15 +58,15 @@ update_project_list_cache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while getopts "lv" option; do
|
while getopts "lv" option; do
|
||||||
debug "Reading option $option"
|
debug "Reading option $option"
|
||||||
case $option in
|
case $option in
|
||||||
l)
|
l)
|
||||||
OPEN_MODE="local"
|
OPEN_MODE="local"
|
||||||
;;
|
;;
|
||||||
v)
|
v)
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
declare -A CUSTOM_SESSIONS
|
declare -A CUSTOM_SESSIONS
|
||||||
@ -76,11 +76,11 @@ spinner &
|
|||||||
spinner_pid=$!
|
spinner_pid=$!
|
||||||
|
|
||||||
if [ ! -f "$CACHE_FILE" ]; then
|
if [ ! -f "$CACHE_FILE" ]; then
|
||||||
debug "Start synchronous project list cache update"
|
debug "Start synchronous project list cache update"
|
||||||
update_project_list_cache
|
update_project_list_cache
|
||||||
else
|
else
|
||||||
debug "Start asynchronous project list cache update"
|
debug "Start asynchronous project list cache update"
|
||||||
update_project_list_cache &
|
update_project_list_cache &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROJECT_LIST=$(cat $CACHE_FILE)
|
PROJECT_LIST=$(cat $CACHE_FILE)
|
||||||
@ -106,10 +106,10 @@ debug "Project path is $PROJECT_PATH"
|
|||||||
debug "Opening in $OPEN_MODE"
|
debug "Opening in $OPEN_MODE"
|
||||||
|
|
||||||
case $OPEN_MODE in
|
case $OPEN_MODE in
|
||||||
"new_pane")
|
"new_pane")
|
||||||
open_new_pane
|
open_new_pane
|
||||||
;;
|
;;
|
||||||
"local")
|
"local")
|
||||||
open_local
|
open_local
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user