All contributions

urfave/cli

urfave/cli

A declarative Go package for building command line tools.

Language
Go
GitHub stars
24,329
Merged changes
1
Project site
cli.urfave.org

What we changed

The help of BoolWithInverseFlag shows one-character non-ASCII names and aliases with a single dash, like every other flag.

What this work shows

  • Runes and bytes in Go
  • CLI help and flag output
  • Table-driven tests in Go
What was broken

Flag ü got two dashes

BoolWithInverseFlag.String() chose - or -- with len(name) == 1, and len() in Go counts bytes. A one-character non-ASCII name such as ü takes two bytes, so the help showed --[no-]ü while any other flag with that name showed -ü.

How we fixed it

The shared prefixFor function

The name and each alias now get their prefix from prefixFor, which the rest of the library uses and which counts characters instead of bytes. Two new cases in TestBoolWithInverseString with ü as the name and as an alias failed before the change.

#2461

Merged change 1

  1. #2461 fix: use prefixFor for BoolWithInverseFlag names and aliases Merged 8 October 2026

What it taught us

We catch the gap in Go between bytes and Unicode characters that makes ü look like a long name, and remove it by moving the code onto the function the rest of the library already uses, instead of adding another special case.

More about this technology: Golang

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.