Skip to content

Commit 433fdc8

Browse files
FTMahringerCopilot
andcommitted
fix(cli): resolve fmt.Printf format string mismatches causing rendering artifacts
- Fix RenderOption: format string had 12 %%s specifiers but only 11 args, causing %!s(MISSING) and %!s(EXTRA) artifacts in TUI output. Replaced with simple string concatenation. - Fix CloseSection: format string read arg #6 but only 5 args provided. Added empty string arg to match. - Fix theme.Sprintf non-constant format string warnings in Header() and DimText(). Replaced with direct string concatenation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b7d77ac commit 433fdc8

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

packages/cli/internal/components/base.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@ func (b *BaseComponent) RenderOption(key, desc string, selected, highlighted boo
8484
} else {
8585
highlight = theme.Gray
8686
}
87-
fmt.Printf("%s│%s %s %s%s%s %s%s%s\n",
88-
theme.Dim, theme.Reset,
89-
color, marker, theme.Reset,
90-
highlight, key, theme.Reset,
91-
theme.Gray, desc, theme.Reset)
87+
fmt.Print(theme.Dim + "│" + theme.Reset + " " + color + " " + marker + theme.Reset + " " + highlight + key + theme.Reset + " " + theme.Gray + desc + theme.Reset + "\n")
9288
}
9389

9490
// RenderCheckbox prints a checkbox option (for multi-select).
@@ -147,7 +143,7 @@ func (b *BaseComponent) RenderError(text string) {
147143
// CloseSection closes the bordered section.
148144
func (b *BaseComponent) CloseSection() {
149145
line := strings.Repeat("─", 60)
150-
fmt.Printf("%s│%s\n%s└%s%s%s\n", theme.Dim, theme.Reset, theme.Dim, line, theme.Reset)
146+
fmt.Printf("%s│%s\n%s└%s%s%s\n", theme.Dim, theme.Reset, theme.Dim, line, theme.Reset, "")
151147
}
152148

153149
// ── Input helpers ──────────────────────────────────────────────────

packages/cli/internal/theme/theme.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func Sprintf(style, format string, a ...any) string {
4141

4242
// Header returns a styled header line.
4343
func Header(text string) string {
44-
return Sprintf(Bold+Blue, text)
44+
return Bold + Blue + text + Reset
4545
}
4646

4747
// OK returns a green checkmark message.
@@ -61,7 +61,7 @@ func Warning(text string) string {
6161

6262
// DimText returns dimmed text.
6363
func DimText(text string) string {
64-
return Sprintf(Dim, text)
64+
return Dim + text + Reset
6565
}
6666

6767
// Label returns a styled label:value pair.

0 commit comments

Comments
 (0)