New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show help for no command and handle unknown command #883
Comments
Same issue here. I don't what to use strict mode as I need to parse unspecified options. My temporary solution is to use a flag in handlers. |
for those waiting for this feature, here is how I do it
|
Another, shorter way: yargs
.demandCommand(1)
.strict() This will throw an error if you don't pass a command, and will print the help at the same time. |
@Zelgadis87 then I guess you have to use |
Specifying default command still removes all commands from yargs.showHelp(callback). +1 |
Cleaning up some stale issues, apologize this one was open for so long. @wclr @Zelgadis87 @gempain there is now the method available @OsmanAltun is working on a fix for |
I trouble to implement folliwng case:
unknown command
if some unknnown command suppliedTo handle unknown command I use default command
*
, it works okBut
demand(1)
here doesn't work in this case so If I supply no command nothing happens at all (it goes to*
handler)I tried to use
yargs.showHelp()
somewhere in '*' handler or just checking main argvbut it doesn't show help. All it shows:
The text was updated successfully, but these errors were encountered: