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

Method lookupFlag

command.go:383–393  ·  command.go::Command.lookupFlag
(name string)

Source from the content-addressed store, hash-verified

381}
382
383func (cmd *Command) lookupFlag(name string) Flag {
384 for _, pCmd := range cmd.Lineage() {
385 if f := pCmd.lFlag(name); f != nil {
386 return f
387 }
388 }
389
390 tracef("flag NOT found for name %[1]q (cmd=%[2]q)", name, cmd.Name)
391 cmd.onInvalidFlag(context.TODO(), name)
392 return nil
393}
394
395// this looks up only allowed flags, i.e. local flags for current command
396// or persistent flags from ancestors

Callers 7

parseFlagsMethod · 0.95
TestFlagValueFunction · 0.95
TestCommand_lookupFlagFunction · 0.95
SetMethod · 0.95
IsSetMethod · 0.95
CountMethod · 0.95
ValueMethod · 0.95

Calls 4

LineageMethod · 0.95
onInvalidFlagMethod · 0.95
tracefFunction · 0.85
lFlagMethod · 0.80

Tested by 2

TestFlagValueFunction · 0.76
TestCommand_lookupFlagFunction · 0.76