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

Method Walk

command.go:587–600  ·  command.go::Command.Walk

Walk visits cmd and every descendant. If fn returns a non-nil error, the walk terminates and the error is returned to the caller.

(fn func(*Command) error)

Source from the content-addressed store, hash-verified

585// Walk visits cmd and every descendant. If fn returns a non-nil error, the
586// walk terminates and the error is returned to the caller.
587func (cmd *Command) Walk(fn func(*Command) error) error {
588 if fn == nil {
589 return nil
590 }
591 if err := fn(cmd); err != nil {
592 return err
593 }
594 for _, sub := range cmd.Commands {
595 if err := sub.Walk(fn); err != nil {
596 return err
597 }
598 }
599 return nil
600}
601
602// Count returns the num of occurrences of this flag
603func (cmd *Command) Count(name string) int {

Callers 6

setupCommandGraphMethod · 0.95
TestCommand_WalkFunction · 0.95
TestCommand_Walk_HiddenFunction · 0.95
TestCommand_Walk_NilFnFunction · 0.95
GfmrunActionFuncFunction · 0.80

Calls

no outgoing calls

Tested by 4

TestCommand_WalkFunction · 0.76
TestCommand_Walk_HiddenFunction · 0.76
TestCommand_Walk_NilFnFunction · 0.76