this looks up only allowed flags, i.e. local flags for current command or persistent flags from ancestors
(name string)
| 395 | // this looks up only allowed flags, i.e. local flags for current command |
| 396 | // or persistent flags from ancestors |
| 397 | func (cmd *Command) lookupAppliedFlag(name string) Flag { |
| 398 | for _, f := range cmd.appliedFlags { |
| 399 | if slices.Contains(f.Names(), name) { |
| 400 | tracef("appliedFlag found for name %[1]q (cmd=%[2]q)", name, cmd.Name) |
| 401 | return f |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | tracef("lookupAppliedflag NOT found for name %[1]q (cmd=%[2]q)", name, cmd.Name) |
| 406 | cmd.onInvalidFlag(context.TODO(), name) |
| 407 | return nil |
| 408 | } |
| 409 | |
| 410 | func (cmd *Command) checkRequiredFlag(f Flag) (bool, string) { |
| 411 | if rf, ok := f.(RequiredFlag); ok && rf.IsRequired() { |
no test coverage detected