#!/bin/bash # dev-workflow.sh - Daily development workflow helper PROJECT_DIR="$HOME/infoscreen-dev" cd "$PROJECT_DIR" echo "🍓 Infoscreen Development Workflow" echo "==================================" # Function to show menu show_menu() { echo "" echo "Select an option:" echo "1) Start development client" echo "2) View live logs" echo "3) Test screenshot capture" echo "4) Test MQTT connection" echo "5) Test presentation tools" echo "6) Git status and sync" echo "7) Restart systemd service" echo "8) Monitor system resources" echo "9) Open tmux session" echo "0) Exit" echo "" } # Function implementations start_client() { echo "🚀 Starting development client..." source venv/bin/activate export $(cat .env | xargs) python3 src/simclient.py } view_logs() { echo "📋 Viewing live logs (Ctrl+C to exit)..." tail -f logs/simclient.log 2>/dev/null || echo "No logs yet, start the client first" } test_screenshot() { echo "📸 Testing screenshot capture..." ./scripts/test-screenshot.sh } test_mqtt() { echo "📡 Testing MQTT connection..." ./scripts/test-mqtt.sh } test_presentation() { echo "🖥️ Testing presentation tools..." ./scripts/test-presentation.sh } git_sync() { echo "📦 Git status and sync..." cd src git status echo "" echo "Pull latest changes? (y/n)" read -r answer if [ "$answer" = "y" ]; then git pull origin main echo "✅ Repository updated" fi cd .. } restart_service() { echo "🔄 Restarting systemd service..." sudo systemctl restart infoscreen-dev sudo systemctl status infoscreen-dev } monitor_system() { echo "📊 System resources (press 'q' to exit)..." htop } open_tmux() { echo "🖥️ Opening tmux session..." tmux new-session -d -s infoscreen 2>/dev/null || tmux attach -t infoscreen } # Main loop while true; do show_menu read -r choice case $choice in 1) start_client ;; 2) view_logs ;; 3) test_screenshot ;; 4) test_mqtt ;; 5) test_presentation ;; 6) git_sync ;; 7) restart_service ;; 8) monitor_system ;; 9) open_tmux ;; 0) echo "👋 Goodbye!"; exit 0 ;; *) echo "❌ Invalid option" ;; esac echo "" echo "Press Enter to continue..." read -r done