Honor help-only input checks before starting features
This commit is contained in:
26
execute.go
26
execute.go
@@ -93,10 +93,13 @@ func (current *execution) prepareFeatures(parsed commandmeta.Result, required bo
|
||||
if offset+count > len(parsed.InvocationFlagValues) || offset+count > len(parsed.InvocationFlagSpellings) {
|
||||
return fmt.Errorf("missing invocation feature flag values")
|
||||
}
|
||||
start, err := feature.payload.prepare(parsed.InvocationFlagValues[offset:offset+count], parsed.InvocationFlagSpellings[offset:offset+count], parsed.FlagOccurrences, required)
|
||||
start, err := feature.payload.prepare(parsed.InvocationFlagValues[offset:offset+count], parsed.InvocationFlagSpellings[offset:offset+count], parsed.FlagOccurrences, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if required && current.featureRequiredError == nil {
|
||||
current.featureRequiredError = feature.payload.requiredError(parsed.InvocationFlagValues[offset : offset+count])
|
||||
}
|
||||
current.featureStarts = append(current.featureStarts, start)
|
||||
offset += count
|
||||
}
|
||||
@@ -104,16 +107,17 @@ func (current *execution) prepareFeatures(parsed commandmeta.Result, required bo
|
||||
}
|
||||
|
||||
type execution struct {
|
||||
app *App
|
||||
ctx context.Context
|
||||
reporter *Reporter
|
||||
featureStarts []func(Invocation) (context.Context, func() Report)
|
||||
featureEnabled bool
|
||||
featureReports []func() Report
|
||||
debugEvents []string
|
||||
snapshot *routingSnapshot
|
||||
session *internalcobra.Session
|
||||
route routeResult
|
||||
app *App
|
||||
ctx context.Context
|
||||
reporter *Reporter
|
||||
featureStarts []func(Invocation) (context.Context, func() Report)
|
||||
featureRequiredError error
|
||||
featureEnabled bool
|
||||
featureReports []func() Report
|
||||
debugEvents []string
|
||||
snapshot *routingSnapshot
|
||||
session *internalcobra.Session
|
||||
route routeResult
|
||||
}
|
||||
|
||||
func (current *execution) startFeatures() {
|
||||
|
||||
Reference in New Issue
Block a user