tj / commander.js

node.js command-line interfaces made easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rewrite error message log function

kolserdav opened this issue · comments

Hi, Thanks for your great work!

I have a stylized logger but commander's error messages have an another view, how can I rewrite error messages?

error: missing required argument 'name'

Maybe you'll could provide a way like this for example:

const program = new Command();
program.errorLogHandler((data) => customLogFunction(data));

There is support for customising the error display using .configureOutput() and supplying writeErr.

https://github.com/tj/commander.js#override-exit-and-output-handling


You are actually using this as the implementation in the PR. What is the problem with using it directly to achieve your goals?

it works, thank you so much. I should have read the documentation more carefully)