Skip to content

feat: add Parent() accessor to Command#2384

Open
happysnaker wants to merge 1 commit into
urfave:mainfrom
happysnaker:fix-hidden-recursive
Open

feat: add Parent() accessor to Command#2384
happysnaker wants to merge 1 commit into
urfave:mainfrom
happysnaker:fix-hidden-recursive

Conversation

@happysnaker

Copy link
Copy Markdown

Fixes #2372

Adds a Parent() method to Command that returns the parent command, or nil for the root command. This allows users to check if a parent is hidden when walking the command tree.

Usage

cmd.Walk(func(c *cli.Command) error {
    if c.Hidden || (c.Parent() != nil && c.Parent().Hidden) {
        return nil
    }
    // process visible command
    return nil
})

@happysnaker happysnaker requested a review from a team as a code owner July 3, 2026 13:12
@happysnaker happysnaker force-pushed the fix-hidden-recursive branch from 6635fe3 to f759d84 Compare July 3, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmd.Hidden is not recursive

1 participant