feat(tmux): Add spinner to project opener

This commit is contained in:
Tanguy Herbron 2023-11-19 11:16:19 +01:00
parent e3a78b077a
commit 8b05631645

View File

@ -23,6 +23,16 @@ debug () {
fi
}
spinner() {
local s="⣾⣽⣻⢿⡿⣟⣯⣷"
local -i i=0
while :; do
printf "%s\\r" "${s:$((i++%4)):1}" >&2
sleep .1
done
}
open_local () {
tmux send-keys "cd $PROJECT_PATH" Enter
@ -52,7 +62,12 @@ open_new_pane () {
declare -A CUSTOM_SESSIONS
CUSTOM_SESSIONS[Projects]=Halia
PROJECT_LIST=$(find ~/* -name .git -type d -prune 2>/dev/null)
spinner &
spinner_pid=$!
PROJECT_LIST=$(find ~/* -name .git -type d -not -path "~/.*" -prune 2>/dev/null)
kill $spinner_pid
SELECTED=$(echo $PROJECT_LIST | sed 's/\/.git/\n/g' | sed "s/$(echo $HOME | sed 's/\//\\\//g')//" | cut -d'/' -f2- | fzf)