Move append existing session logic to launcher

This commit is contained in:
Yan Lin 2025-07-29 19:30:02 +02:00
parent e95e125151
commit d272de21c3
3 changed files with 11 additions and 11 deletions

View file

@ -103,6 +103,16 @@ if [ -n "$SERVER" ] && [ -n "$REMOTE_DIR" ]; then
fi
fi
# Check if session already exists and attach if it does
if is_session_running "$SESSION_NAME"; then
printf "\033[1;32mAttaching to existing session: %s\033[0m\n" "$SESSION_NAME"
tmux attach-session -t "$SESSION_NAME"
exit 0
fi
# Update papis cache
papis cache reset > /dev/null 2>&1
# Launch appropriate template
case "$TEMPLATE" in
"basic")
@ -123,4 +133,4 @@ case "$TEMPLATE" in
echo "Error: Unknown template '$TEMPLATE'"
exit 1
;;
esac
esac