You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ node test.js --help --show-hidden
Options:
--version Show version number [boolean]
--help help [boolean]
--show-hidden Show hidden options [boolean]
Where the foo option isn't shown, despite --help and --show-hidden being specified. If 'strip-dashed': true, is commented out, the new output is:
$ node test.js --help --show-hidden
Options:
--version Show version number [boolean]
--help help [boolean]
--show-hidden Show hidden options [boolean]
--foo bar [string]
Which is properly displaying the foo option.
The text was updated successfully, but these errors were encountered:
Thanks for report. I reproduced, and think it is a bug.
A work-around would be to use an option name without a dash with showHidden. (Which you likely realised, having helpfully tracked down the dependence on 'strip-dashed'.)
This is one of several bugs introduced by allowing the author to call parserConfiguration. Sigh. Flexibility leads to complications! Yargs needs to do more work to find whether a "known" option is present in the parsed args. The (overly) simple check is:
One of the previous fixes for a situation where Yargs wanted to iterate over all the possible permutations was: #2308
This case is simpler, just want to lookup option by any name. That could be done by taking into account the parserConfiguration, or could be done by iterating over the aliases. Given this has come up a few times I would like to add a utility routine to wrap the logic.
My current solution was to remove the strip-dashed since I didn't like the aesthetic of showHidden being camel case with the rest of the options being kebab case 😅
Minimal Repro:
Outputs:
Where the
foo
option isn't shown, despite --help and --show-hidden being specified. If'strip-dashed': true,
is commented out, the new output is:Which is properly displaying the
foo
option.The text was updated successfully, but these errors were encountered: