Default command does not change help script
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
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:
```js
const sade = require("sade");
const cli = sade("test")
.command("something ", undefined, { default: true })
.action((a) => console.log(a))
.command("somethingelse ")
.action((b) => console.log(b));
cli.parse(process.argv);
```
```
$ node dist/repro.js --help
Usage
$ test [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 [options]
Options
-h, --help Displays this message
```
```
$ node dist/repro.js something
ERROR
Insufficient arguments!
Run `$ test something --help` for more info.
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the commands in repro.js and compare the default command's help and invocation with the explicit `something` command. Trace the CLI entry point that handles `--help` and default commands; done means the default command's argument usage appears in help and the default invocation reports only the appropriate argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100