Skip to content

Commit 27b30c2

Browse files
committed
feat: add color coding to statusline segments
Color-code git branch (green=clean, red=dirty) and progress indicators (green when all tasks complete) for at-a-glance status.
1 parent ee7d863 commit 27b30c2

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

extensions/itkdev-statusline/bin/statusline.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ if [[ -f "$head_file" ]]; then
3030
else
3131
branch="${head_content:0:7}" # detached HEAD — short hash
3232
fi
33-
segments+=("$branch")
33+
if [[ -z "$(git -C "$cwd" status --porcelain 2>/dev/null)" ]]; then
34+
segments+=($'\033[32m'"${branch}"$'\033[0m') # green = clean
35+
else
36+
segments+=($'\033[31m'"${branch}"$'\033[0m') # red = dirty
37+
fi
3438
fi
3539

3640
# ── Plan progress ──────────────────────────────────────────────────────
@@ -58,7 +62,11 @@ if [[ -d "$plan_dir" ]]; then
5862
total="${total:-0}"
5963
done="${done:-0}"
6064
if (( total > 0 )); then
61-
segments+=("${done}/${total}")
65+
if (( done == total )); then
66+
segments+=($'\033[32m'"${done}/${total}"$'\033[0m') # green = complete
67+
else
68+
segments+=("${done}/${total}")
69+
fi
6270
fi
6371
fi
6472
fi
@@ -81,7 +89,11 @@ if [[ -n "${transcript:-}" && -f "$transcript" ]]; then
8189
task_done="${task_counts%% *}"
8290
task_total="${task_counts##* }"
8391
if (( task_total > 0 )); then
84-
segments+=("${task_done}/${task_total}")
92+
if (( task_done == task_total )); then
93+
segments+=($'\033[32m'"${task_done}/${task_total}"$'\033[0m') # green = complete
94+
else
95+
segments+=("${task_done}/${task_total}")
96+
fi
8597
fi
8698
fi
8799
fi

0 commit comments

Comments
 (0)