Preserve ordered flag occurrences
This commit is contained in:
13
command.go
13
command.go
@@ -127,6 +127,13 @@ type preparedValue[I any] struct {
|
||||
identity *bindingIdentity
|
||||
supplied bool
|
||||
apply func(*I)
|
||||
ordered []preparedOccurrence[I]
|
||||
}
|
||||
|
||||
type preparedOccurrence[I any] struct {
|
||||
// Captured bindings share this position with the outer prepared occurrence.
|
||||
ordinal *int
|
||||
apply func(*I)
|
||||
}
|
||||
|
||||
type flagBinding[I any] struct {
|
||||
@@ -186,7 +193,7 @@ type commandPayload interface {
|
||||
hasRun() bool
|
||||
bridgeFlags() []commandmeta.Flag
|
||||
bridgeArguments() []commandmeta.Argument
|
||||
prepare([][]string, [][]string, []string, bool) (func(*execution) Outcome, error)
|
||||
prepare([][]string, [][]string, []commandmeta.FlagOccurrence, []string, bool) (func(*execution) Outcome, error)
|
||||
}
|
||||
|
||||
type typedCommand[I any] struct {
|
||||
@@ -235,8 +242,8 @@ func (c typedCommand[I]) bridgeArguments() []commandmeta.Argument {
|
||||
return arguments
|
||||
}
|
||||
|
||||
func (c typedCommand[I]) prepare(flagValues, flagSpellings [][]string, operands []string, enforceRequired bool) (func(*execution) Outcome, error) {
|
||||
prepared, err := prepareInputWithSpellings(c.spec, flagValues, flagSpellings, operands, enforceRequired)
|
||||
func (c typedCommand[I]) prepare(flagValues, flagSpellings [][]string, occurrences []commandmeta.FlagOccurrence, operands []string, enforceRequired bool) (func(*execution) Outcome, error) {
|
||||
prepared, err := prepareInputWithOccurrences(c.spec, flagValues, flagSpellings, occurrences, operands, enforceRequired)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user