I have the following code
const yargs = require("yargs");
const parser = yargs.command("test", "description", (yargs) => {
yargs.version("1.0.0");
});
yargs.command("test2", "description2", (yargs) => {
yargs.version("1.0.0");
});
parser.parse("test2");
(async () => {
const output = await yargs.getHelp();
console.log(output);
})();
and it gives me the following result
$ node t.js
t.js test2
description2
Options:
--help Show help [boolean]
--version Show version number [boolean]
this help is for "test2" but I don't want to get that
if I comment out
// parser.parse("test2");
this is the result that I need
$ node t.js
t.js [command]
Commands:
t.js test description
t.js test2 description2
Options:
--help Show help [boolean]
--version Show version number [boolean]
so basically I want to get the main help result after parsing. If I use parse then getHelp, it is giving me the help for the parsed command
is there any way so I can get the main help
- aside from storing it to some variable