From 4e9b42e7d0296507ab9aa7171b612e26660f3487 Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 13:02:16 +0000 Subject: [PATCH] fix(cli): make check output width-aware Co-Authored-By: Virgil --- pkg/cli/check.go | 6 +++--- pkg/cli/check_test.go | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/cli/check.go b/pkg/cli/check.go index aa32898..428539a 100644 --- a/pkg/cli/check.go +++ b/pkg/cli/check.go @@ -69,14 +69,14 @@ func (c *CheckBuilder) String() string { icon = c.style.Render(icon) } - status := compileGlyphs(c.status) + name := Pad(compileGlyphs(c.name), 20) + status := Pad(compileGlyphs(c.status), 10) if c.style != nil && c.status != "" { status = c.style.Render(status) } - name := compileGlyphs(c.name) if c.duration != "" { - return Sprintf(" %s %-20s %-10s %s", icon, name, status, DimStyle.Render(compileGlyphs(c.duration))) + return Sprintf(" %s %s %s %s", icon, name, status, DimStyle.Render(compileGlyphs(c.duration))) } if status != "" { return Sprintf(" %s %s %s", icon, name, status) diff --git a/pkg/cli/check_test.go b/pkg/cli/check_test.go index 0871d4b..2f3aca0 100644 --- a/pkg/cli/check_test.go +++ b/pkg/cli/check_test.go @@ -46,6 +46,9 @@ func TestCheckBuilder(t *testing.T) { if got == "" { t.Error("Empty output for Duration") } + if !strings.Contains(got, "foo ") { + t.Error("Expected width-aware padding for the check name") + } // Message c = Check("foo").Message("status")