diff --git a/command.go b/command.go index 4cd907a558..8fef2f3d3c 100644 --- a/command.go +++ b/command.go @@ -337,6 +337,11 @@ func (cmd *Command) argsWithDefaultCommand(oldArgs Args) Args { } // Root returns the Command at the root of the graph +// Parent returns the parent command, or nil if this is the root command. +func (cmd *Command) Parent() *Command { + return cmd.parent +} + func (cmd *Command) Root() *Command { if cmd.parent == nil { return cmd