[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find features des... #60

Merged
Virgil merged 1 commit from agent/read---spec-code-core-go-cli-rfc-md-full into dev 2026-04-02 06:31:27 +00:00
2 changed files with 20 additions and 0 deletions
Showing only changes of commit aa537c89ca - Show all commits

View file

@ -14,11 +14,17 @@ func Sprint(args ...any) string {
// Styled returns text with a style applied.
func Styled(style *AnsiStyle, text string) string {
if style == nil {
return compileGlyphs(text)
}
return style.Render(compileGlyphs(text))
}
// Styledf returns formatted text with a style applied.
func Styledf(style *AnsiStyle, format string, args ...any) string {
if style == nil {
return compileGlyphs(fmt.Sprintf(format, args...))
}
return style.Render(compileGlyphs(fmt.Sprintf(format, args...)))
}

View file

@ -222,3 +222,17 @@ func TestPad_Good(t *testing.T) {
assert.Equal(t, "hello", Pad("hello", 3))
assert.Equal(t, "東京 ", Pad("東京", 6))
}
func TestStyled_Good_NilStyle(t *testing.T) {
restoreThemeAndColors(t)
UseASCII()
assert.Equal(t, "hello [OK]", Styled(nil, "hello :check:"))
}
func TestStyledf_Good_NilStyle(t *testing.T) {
restoreThemeAndColors(t)
UseASCII()
assert.Equal(t, "value: [WARN]", Styledf(nil, "value: %s", ":warn:"))
}