Skip to content

fix(command): treat subcommands of hidden commands as hidden recursively - #2463

Open
AdamMagued wants to merge 3 commits into
urfave:mainfrom
AdamMagued:fix-issue-2372
Open

AdamMagued wants to merge 3 commits into
urfave:mainfrom
AdamMagued:fix-issue-2372

Conversation

@AdamMagued

@AdamMagued AdamMagued commented Oct 9, 2026 •

Copy link
Copy Markdown

Fixes #2372

Summary

  • Propagated hidden visibility to subcommands when parent command has Hidden: true.
  • Added unit tests covering hidden command recursion in help output.

Verified via container sandbox test suite.

@AdamMagued
AdamMagued requested a review from a team as a code owner October 9, 2026 05:57
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium impact] Changes how command visibility inheritance works in the CLI framework.

The PR appears safe to merge, with a non-blocking loss of shell choices when the completion command is made public.

Findings

  1. P2 Public completion loses shell choices ▶

Summary

The PR makes subcommands inherit hidden visibility in help, categories, shell suggestions, and Walk.

  • Adds tests for nested hidden commands and generated completion commands.
  • Explicitly hiding completion shells also removes their choices when users make the completion command public.

Reviews (1) · Last reviewed commit: "fix(command): inherit Hidden visibility ..." · Reviewed by Greptile

Comment thread completion.go Outdated
func buildShellCompletionSubcommand(shell string, render renderCompletion, appName string) *Command {
return &Command{
Name: shell,
Hidden: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Public completion loses shell choices

Setting cmd.Hidden = false in ConfigureShellCompletionCommand no longer makes the completion shells visible. Each shell now has its own Hidden: true, so help and shell suggestions omit bash, zsh, fish, and pwsh even when their parent is public. Users can still run them by typing the full command.

Leave the shells visible by default and let isHidden() inherit their parent's visibility. Add a test for the documented customization.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed explicit Hidden: true on individual shell completion subcommands so their visibility dynamically inherits from the parent completion command via isHidden(). Added unit tests covering shell subcommand visibility in help output, shell suggestions, and dynamic customization when the completion command is made public.

Signed-off-by: AdamMagued <adamismailmageud@gmail.com>
@AdamMagued AdamMagued changed the title fix(command): inherit Hidden visibility across subcommands fix(command): treat subcommands of hidden commands as hidden recursively Oct 9, 2026

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmd.Hidden is not recursive

1 participant