Interpret command flag aliases in the parser

This commit is contained in:
2026-10-19 19:31:23 +00:00
parent 58b71c390f
commit 75fc45f072
8 changed files with 389 additions and 11 deletions

View File

@@ -41,6 +41,12 @@ type Flag struct {
Required bool
}
// FlagAlias maps one option spelling to a canonical flag spelling.
type FlagAlias struct {
Source string
Target string
}
// Failure is a neutral parsing or presentation failure.
type Failure struct {
Message string
@@ -53,14 +59,16 @@ type Result struct {
Path []string
HelpRequested bool
FlagValues [][]string
FlagSpellings [][]string
Operands []string
Failure *Failure
}
// ParseOptions makes parser context and streams explicit.
type ParseOptions struct {
Context context.Context
In io.Reader
Out io.Writer
Err io.Writer
Context context.Context
In io.Reader
Out io.Writer
Err io.Writer
FlagAliases []FlagAlias
}