Preserve reporting flag occurrence order

This commit is contained in:
2026-10-26 02:55:08 +00:00
parent f3bd6dc2ae
commit df21b75f9c
7 changed files with 320 additions and 19 deletions

View File

@@ -91,15 +91,41 @@ type Failure struct {
Usage bool
}
// FlagOccurrence records one parsed spelling and its unconverted value.
type FlagOccurrence struct {
Name string // canonical flag name
Spelling string // entered long spelling or individual short spelling
RawValue string // unconverted value collected by the parser
}
// ReportingMode selects visibility for shared reporting messages.
type ReportingMode uint8
const (
ReportingModeNormal ReportingMode = iota
ReportingModeQuiet
ReportingModeVerbose
ReportingModeDebug
)
// ReportingSelection contains the resolved reporting options for one parse.
type ReportingSelection struct {
Mode ReportingMode
Progress bool
ProgressSet bool
}
// Result contains the selected command and raw input collected by the adapter.
type Result struct {
Key Key
Path []string
HelpRequested bool
FlagValues [][]string
FlagSpellings [][]string
Operands []string
Failure *Failure
Key Key
Path []string
HelpRequested bool
FlagValues [][]string
FlagSpellings [][]string
FlagOccurrences []FlagOccurrence
Reporting ReportingSelection
Operands []string
Failure *Failure
}
// ParseOptions makes parser context and streams explicit.