sade
sade copied to clipboard
Default command does not change help script
If I define two commands and mark one default, the returned help text via cli.js --help
shows the arguments as if no command was called even though I can supply an argument.
repro.js:
const sade = require("sade");
const cli = sade("test")
.command("something <a>", undefined, { default: true })
.action((a) => console.log(a))
.command("somethingelse <b>")
.action((b) => console.log(b));
cli.parse(process.argv);
$ node dist/repro.js --help
Usage
$ test <command> [options]
Available Commands
something
somethingelse
For more info, run any command with the `--help` flag
$ test something --help
$ test somethingelse --help
Options
-v, --version Displays current version
-h, --help Displays this message
$ node dist/repro.js
ERROR
Insufficient arguments!
Run `$ test something --help` for more info.
$ node dist/repro.js something --help
Usage
$ test something <a> [options]
Options
-h, --help Displays this message
$ node dist/repro.js something
ERROR
Insufficient arguments!
Run `$ test something --help` for more info.