-
Notifications
You must be signed in to change notification settings - Fork 343
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 usage on missing or wrong command. #311
Conversation
I think it's better to do this with |
Were you trying on web-ext 1.0.1 or one built against master? When I try against master it's pretty good but it needs this patch to handle sub-command options: diff --git a/src/program.js b/src/program.js
index 7b21b16..2f03ae4 100644
--- a/src/program.js
+++ b/src/program.js
@@ -37,7 +37,7 @@ export class Program {
}
// Calling env will be unnecessary after
// https://github.com/yargs/yargs/issues/486 is fixed
- return yargs.env(envPrefix).options(commandOptions);
+ return yargs.strict().env(envPrefix).options(commandOptions);
});
this.commands[name] = executor;
return this;
|
^ that causes the test process to exit though because yargs exits the process. My idea for dealing with that was: #169 (comment) |
@kumar303 pushed another approach which works for me, anything wrong with that one? Tests seem to be passing. |
The thing that looks ugly on master for me is simply typing |
Thanks! Looks good and the patch works for me. It doesn't address #169 but we can do that in a separate patch (it's a related but separate issue). |
It's pretty annoying that you only get a stack trace when simply running
web-ext
without any arguments for the first time, so I added help messages.