Skip to content

fix: support show-hidden when parser has strip-dashed or strip-camel-case - #2626

Closed
EnesKartal wants to merge 1 commit into
yargs:mainfrom
EnesKartal:fix-show-hidden-strip-dashed
Closed

EnesKartal wants to merge 1 commit into
yargs:mainfrom
EnesKartal:fix-show-hidden-strip-dashed

Conversation

@EnesKartal

Copy link
Copy Markdown

Fixes #2356

Description

When parserConfiguration({ 'strip-dashed': true }) is configured, dashed keys (such as 'show-hidden') are stripped from argv, leaving only camelCased keys (such as 'showHidden'). Previously, filterHiddenOptions() in lib/usage.ts checked only (yargs.parsed as DetailedArguments).argv[yargs.getOptions().showHiddenOpt]. As a result, when 'strip-dashed': true was used, passing --show-hidden did not reveal hidden options. Similarly, if 'strip-camel-case': true was used with a camelCase option name or if an alias was used, hidden options would not be displayed.

This PR updates filterHiddenOptions() to check all aliases and camelCased/dashed variations of showHiddenOpt.

  • Added tests in test/usage.mjs verifying that hidden options are properly displayed when 'strip-dashed': true and 'strip-camel-case': true.
  • All 845 tests passing with 100% coverage and zero lint issues.

@shadowspawn

Copy link
Copy Markdown
Member

Unsolicited Pull Requests may be closed without discussion.

For more see Contributing and AI Policy.

@shadowspawn shadowspawn closed this Nov 8, 2026
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.

show-hidden broken if parser has strip-dashed config

2 participants