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
Editing error #1498
Comments
There is not direct support for changing the error messages. You could perhaps override https://github.com/tj/commander.js#override-exit-and-output-handling |
Thanks. |
Oh. Custom error handling does not replace the message. It just adds custom text to the message. |
This is how I thought const { program } = require('commander');
program.option('-p, --port <number>');
program.configureOutput({
outputError: (str, write) => {
if (str.startsWith('error: unknown option'))
write('custom unknown option error\n');
else
write(str);
}
});
program.parse();
|
Thanks a lot! It works! |
There is an open issue about adding support for modifying and/or localising error messages: #1801 |
Is there any way to edit this:
I want to make custom "unknown option" text.
The text was updated successfully, but these errors were encountered: