VisitParents visits all parents of the command and invokes fn on each parent.
(fn func(*Command))
| 882 | |
| 883 | // VisitParents visits all parents of the command and invokes fn on each parent. |
| 884 | func (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. |
| 892 | func (c *Command) Root() *Command { |