You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Single-rune Unicode flags can be emitted by completion but not parsed #2433
I searched existing issues and pull requests for this problem.
Dependency Management
My project is using Go modules.
Describe the bug
Single-rune Unicode flag names are handled inconsistently. Shell completion counts runes and emits a single-dash flag such as -ש, but help formatting counts bytes and displays --ש. More importantly, the parser examines rune(firstArg[1]), which converts only the first UTF-8 byte rather than decoding the first rune.
For ש, the first byte is 0xD7; converting that byte to a rune produces ×, which is not a letter. The parser therefore classifies -ש as a positional argument and never sets the registered flag.
Help formatting also prefixes this single-rune name with --, while flag completion uses -.
Expected behavior
A one-rune Unicode flag should be treated consistently with a one-byte ASCII flag:
value="value" args=["operand"]
Help and completion should both render it as -ש.
Additional context
prefixFor uses len(name) == 1, while completion already uses utf8.RuneCountInString. In parseFlags, decoding the first rune after the leading dash instead of converting firstArg[1] would preserve existing ASCII behavior and correctly classify Unicode letters.
Want to fix this yourself?
Yes. The fix is small and can be covered by a focused regression test.
Activity
fix: parse single-rune Unicode flags