I want to completely overwrite usage information from commander js:
Usage: name [options]
Options:
-V, --version output the version number
-h, --help display help for command
to create my own. However, I cannot find option to do that.
I want to completely overwrite usage information from commander js:
Usage: name [options]
Options:
-V, --version output the version number
-h, --help display help for command
to create my own. However, I cannot find option to do that.
Alternatively, a function helpInformation()
in Commander returns the help content, which may help to override the whole generated help text.
I am unsure whether it is part of the public API, but it is available in commander v9.4.1 and most likely in other versions.
const showCustom = process.argv.indexOf("--help") >= 0 || process.argv.indexOf("-h") >= 0
if (showCustom)
{
const content = program.helpInformation();
console.log(content);
return ;
}
program.parse();
From the README: https://github.com/tj/commander.js