Skip to content

Uppercase only the first rune of CLI error messages#206

Closed
yummybomb wants to merge 1 commit into
mainfrom
hypeship/fix-error-title-case
Closed

Uppercase only the first rune of CLI error messages#206
yummybomb wants to merge 1 commit into
mainfrom
hypeship/fix-error-title-case

Conversation

@yummybomb

Copy link
Copy Markdown
Contributor

Summary

fang's default ErrorText style applies a titleFirstWord transform that runs cases.Title over the first whitespace-delimited word of an error message. cases.Title capitalizes after every unicode word boundary inside the token (/ and - included), so any error that begins with a path or identifier gets mangled:

ERROR  /Tmp/Audit-Smoke.jsonl.gz already exists; pass --force to overwrite

This replaces the transform in our error handler with one that uppercases only the first rune of the message:

  • unknown flag: --fooUnknown flag: --foo (sentence casing preserved)
  • /tmp/out.jsonl.gz already exists → unchanged
  • --start must be before --end → unchanged

Test plan

  • go test ./cmd (includes new TestUpperFirst unit test)
  • go vet ./...
  • Manual check: kernel browsers --bogus-flag renders Unknown flag: --bogus-flag

fang's default ErrorText transform title-cases the entire first word,
which mangles errors that start with a path or identifier ("/tmp/out.gz
already exists" rendered as "/Tmp/Out.gz already exists"). Replace the
transform with one that uppercases only the first rune, preserving
sentence casing for lowercase errors while leaving paths and flags
untouched.
@yummybomb yummybomb closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant