Interpret command flag aliases in the parser
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user