-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Milestone
Description
I have a command line application with the output redirected to a file.
node app.js mandatory-argument > output.dat
If mandatory-argument is not present, commander help() function is called. Unfortunately the help text goes to the output file due to the redirection. In the commander source file, the help output is hardcoded to go to stdout (line 1147).
A workaround is to call help() this way:
const cb = (hlpText: string): string => {
process.stderr.write(hlpText);
return "";
};
program.help(cb);
But should be simpler if all commander messages go to stderr and not to stdout.
Thanks for looking!
mario
Reactions are currently unavailable