MCPcopy
hub / github.com/urfave/cli / lookupAppliedFlag

Method lookupAppliedFlag

command.go:397–408  ·  view source on GitHub ↗

this looks up only allowed flags, i.e. local flags for current command or persistent flags from ancestors

(name string)

Source from the content-addressed store, hash-verified

395// this looks up only allowed flags, i.e. local flags for current command
396// or persistent flags from ancestors
397func (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
410func (cmd *Command) checkRequiredFlag(f Flag) (bool, string) {
411 if rf, ok := f.(RequiredFlag); ok && rf.IsRequired() {

Callers 1

parseFlagsMethod · 0.95

Calls 3

onInvalidFlagMethod · 0.95
tracefFunction · 0.85
NamesMethod · 0.65

Tested by

no test coverage detected