MCPcopy
hub / github.com/spf13/cobra / VisitParents

Method VisitParents

command.go:884–889  ·  view source on GitHub ↗

VisitParents visits all parents of the command and invokes fn on each parent.

(fn func(*Command))

Source from the content-addressed store, hash-verified

882
883// VisitParents visits all parents of the command and invokes fn on each parent.
884func (c *Command) VisitParents(fn func(*Command)) {
885 if c.HasParent() {
886 fn(c.Parent())
887 c.Parent().VisitParents(fn)
888 }
889}
890
891// Root finds root command.
892func (c *Command) Root() *Command {

Callers 5

TestVisitParentsFunction · 0.95
updateParentsPflagsMethod · 0.95
genManFunction · 0.80
GenReSTCustomFunction · 0.80
GenMarkdownCustomFunction · 0.80

Calls 2

HasParentMethod · 0.95
ParentMethod · 0.95

Tested by 1

TestVisitParentsFunction · 0.76