Skip to content

Exclude hidden and deprecated commands from usage padding calculation#2373

Open
kovan wants to merge 1 commit intospf13:mainfrom
kovan:fix/hidden-command-padding
Open

Exclude hidden and deprecated commands from usage padding calculation#2373
kovan wants to merge 1 commit intospf13:mainfrom
kovan:fix/hidden-command-padding

Conversation

@kovan
Copy link
Copy Markdown

@kovan kovan commented Mar 26, 2026

Hidden and deprecated commands are not shown in usage output, but their names were included when calculating the maximum column widths for formatting. This caused unnecessary extra padding when a hidden or deprecated command had a longer name than any visible command.

This PR skips hidden and deprecated commands in both AddCommand and RemoveCommand when computing commandsMaxUseLen, commandsMaxCommandPathLen, and commandsMaxNameLen.

Continues the work from stale PR #1632 (open since 2022, no activity since November 2022).

Fixes #1272

Hidden and deprecated commands are not shown in usage output, but their
names were included when calculating the maximum column widths for
formatting. This caused unnecessary padding when a hidden or deprecated
command had a longer name than any visible command.

Skip hidden and deprecated commands in both AddCommand and
RemoveCommand when computing commandsMaxUseLen,
commandsMaxCommandPathLen, and commandsMaxNameLen.

Fixes spf13#1272
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

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.

Hidden Commands Should be Ignored When Calculating Use Indentation

3 participants