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
@OsmanAltun I think what's actually happening here, is that because .help() and .version() are special options which are automatically registered, overriding their description is not having the intended affect. Probably because, when an inner command fires, it just re-adds the .help() and .version() with their default description.
Here's a workaround I'd suggest, if you want to override their default text:
importyargsfrom'yargs'consty=yargs().locale('en')y.updateStrings({'Show help': 'Dis supposed to be help','Show version number': 'Dis supposed to be version'})letoutputconstoptions={exec: {alias: 'e',desc: 'Dis supposed to be exec',type: 'string',requiresArg: true},h: {alias: 'help'},v: {alias: 'version'}}y.options(options)y.parse(['--help'],(_err,_argv,_output)=>{output=_output})console.log(output)
☝️ keeping in mind that this means people in other locales won't get the benefit of a translated string.
While I think this issue might have inadvertently been addressed by #1826, I think actually supporting the behavior of allowing the description of --help and --version to be overridden is likely just a new feature we'd need to add.
The code:
Expected output:
Actual output:
Note
No need for a workaround since I already got one, but I just wanted to mention this so it would get fixed.
The text was updated successfully, but these errors were encountered: