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

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

Conversation

@happysnaker

Copy link
Copy Markdown
Contributor

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
@dearchap

dearchap commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Related to #2376

@dearchap

Copy link
Copy Markdown
Contributor

@happysnaker can you fix the tests ?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/waiting-for-response Waiting for response from original requester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmd.Hidden is not recursive

2 participants