From 63481f127cfc6f130730c6c714263c000af22b44 Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 12:51:00 +0000 Subject: [PATCH] fix(cli): render glyph shortcodes in task tracker Co-Authored-By: Virgil --- pkg/cli/tracker.go | 8 +++++++- pkg/cli/tracker_test.go | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pkg/cli/tracker.go b/pkg/cli/tracker.go index 060fbd6..681a3f1 100644 --- a/pkg/cli/tracker.go +++ b/pkg/cli/tracker.go @@ -166,6 +166,8 @@ func (tr *TaskTracker) waitStatic() { allDone := true for i, t := range tasks { name, status, state := t.snapshot() + name = compileGlyphs(name) + status = compileGlyphs(status) if state != taskDone && state != taskFailed { allDone = false continue @@ -227,6 +229,8 @@ func (tr *TaskTracker) renderLine(idx, frame int) { tr.mu.Unlock() name, status, state := t.snapshot() + name = compileGlyphs(name) + status = compileGlyphs(status) nameW := tr.nameWidth() var icon string @@ -259,7 +263,7 @@ func (tr *TaskTracker) nameWidth() int { defer tr.mu.Unlock() w := 0 for _, t := range tr.tasks { - if nameW := displayWidth(t.name); nameW > w { + if nameW := displayWidth(compileGlyphs(t.name)); nameW > w { w = nameW } } @@ -311,6 +315,8 @@ func (tr *TaskTracker) String() string { var sb strings.Builder for _, t := range tasks { name, status, state := t.snapshot() + name = compileGlyphs(name) + status = compileGlyphs(status) icon := Glyph(":pending:") switch state { case taskDone: diff --git a/pkg/cli/tracker_test.go b/pkg/cli/tracker_test.go index 138db76..98122e9 100644 --- a/pkg/cli/tracker_test.go +++ b/pkg/cli/tracker_test.go @@ -171,6 +171,20 @@ func TestTaskTracker_Good(t *testing.T) { assert.Contains(t, out, "⠋") }) + t.Run("glyph shortcodes render in names and statuses", func(t *testing.T) { + restoreThemeAndColors(t) + UseASCII() + + tr := NewTaskTracker() + tr.out = &bytes.Buffer{} + + tr.Add(":check: repo").Done("done :warn:") + + out := tr.String() + assert.Contains(t, out, "[OK] repo") + assert.Contains(t, out, "[WARN]") + }) + t.Run("ASCII theme uses ASCII symbols", func(t *testing.T) { restoreThemeAndColors(t) UseASCII() -- 2.45.3