From cf177c060ef0ecac4422cfde4c491043e815b512 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sat, 26 Jul 2025 23:11:13 +0200 Subject: [PATCH] Enhance project list display with descriptions and visual formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add colorful header with 📋 icon and cyan title - Display project descriptions (previously unused) - Add template-based icons: 🚀 content, 🔬 research, ⚙️ basic - Format output in aligned columns with colors - Include template type indicators in brackets - Add usage hint for better user experience - Improve error handling for missing jq The 'proj' command now provides rich, informative output instead of just listing project names. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/project-launcher.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/scripts/project-launcher.sh b/scripts/project-launcher.sh index 56b468b..7140109 100755 --- a/scripts/project-launcher.sh +++ b/scripts/project-launcher.sh @@ -9,9 +9,36 @@ PROJECTS_JSON="$CONFIG_DIR/projects.json" TEMPLATES_DIR="$(dirname "$0")/templates" if [ -z "$PROJECT_NAME" ]; then - echo "Available projects:" + printf "📋 \033[1;36mAvailable Projects:\033[0m\n\n" + if [ -f "$PROJECTS_JSON" ]; then - jq -r '.projects | keys[]' "$PROJECTS_JSON" 2>/dev/null || echo "No projects configured" + # Check if jq is available and JSON is valid + if ! command -v jq >/dev/null 2>&1; then + echo "Error: jq not found. Please install jq or run 'home-manager switch'." + exit 1 + fi + + # Parse and display projects with descriptions and icons + jq -r '.projects | to_entries[] | "\(.key)|\(.value.description)|\(.value.template)"' "$PROJECTS_JSON" 2>/dev/null | \ + while IFS='|' read -r name desc template; do + # Assign icons based on template type + case "$template" in + "content") icon="🚀" ;; + "research") icon="🔬" ;; + "basic") icon="⚙️" ;; + *) icon="📁" ;; + esac + + # Format with consistent spacing + printf " %s \033[1;32m%-12s\033[0m %-35s \033[2m[%s]\033[0m\n" \ + "$icon" "$name" "$desc" "$template" + done + + if [ $? -ne 0 ]; then + echo "No projects configured" + else + printf "\n\033[2mUsage: proj or just type the project name directly\033[0m\n" + fi else echo "No projects configured - run 'home-manager switch' to generate config" fi