-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Currently, short flag aliases only support -c 100 and -c=100 syntax. The concatenated form -c100 (no space or equals) fails with:
error: command "rewrap": flag provided but not defined: -c100
This is because short aliases are registered as regular flags in a flag.FlagSet via combineFlags(), and Go's flag.FlagSet.Parse() does not support the concatenated form.
Feasibility
This is doable with a small arg-rewriting pass in xflag.ParseToEnd. The FlagSet is already available there, so the approach would be:
- Scan args for patterns like
-X<value>whereXis a known single-letter flag that expects a value - Expand
-c100into-c100before passing toflag.Parse() - Use the
FlagSetto distinguish-c100(short flagcwith value100) from-verbose(long flag namedverbose) by checking if a single-char flag exists - Skip boolean flags since they don't take values (and
-vnstyle combining is out of scope)
The scope is contained -- mostly changes to xflag/parse.go with maybe a small helper.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels