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
Updating console.error messages suggesting to clients run --help command #766
Comments
I am interested in this as well. Please send that PR! |
I'll send the PR ASAP. |
Adding one more console.error statements to bellow methods: - Command.prototype.missingArgument - Command.prototype.optionMissingArgument - Command.prototype.unknownOption - Command.prototype.variadicArgNotLast This console.error messages propose to user run the same command with `--help` option to get more info about the command which try to run. This is something that most UNIX like commands do (like rm, cp, mv, etc)
For interest, I looked at the suggested unix commands and
|
This issue has not had any activity in over six months. It isn't likely to get acted on due to this report. Feel free to open a new issue if it comes up again, with new information and renewed interest. Thank you for your contributions. |
Related: |
I post a possible enchantment.
Description
One of the core features of commander.js is the ability to show meaningful error messages to the user. The API provides
.on('--help', cb)
listener on commands that allow users to add custom help messages (a description, examples, etc). However, to be able someone gets those help information he needs to provide--help
argument in the command. For instance, if we have the following commandnode index.js rm <file>
we are able to provide an.on('--help', cb)
listener tocommand('rm <file>')
.When new clients want to use our CLI tool will find themselves, most of the time, struggling to figure out how to use a command. For instance, if they forget the
<file>
argument inrm
they'll face the following error message:Our client now needs to go to our API documentation and search what the
<file>
argument is (a path or name?). For simple commands, such as the above example, this isn't something interesting, but in more sophisticated commands, this actually can add headaches. Of course, the client can always add--help
argument to that command and get the appropriate information. But most of the times, he will miss it.Proposal Fix
I propose to update those error messages by adding one more line that will suggest our client try the
--help
argument. As such, the above message will be changed to:This is something that most UNIX like commands do (check
rm
,cp
,mv
, etc) and I believe that increases the User Experience. Of course, we can propose other alternatives as well: Print the whole help page below the error message, but in my opinion, this is something that would add more noise.A fix like this will not add any break changes to the codebase nor will decrease the test coverage.
If you agree with this idea, I will immediately open a new pull request.
The text was updated successfully, but these errors were encountered: