[feature request] Command `--help` should show available subcommands
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
```js
prog
.command('foo')
.describe('Top level command')
.action(() => console.log('see `app foo --help`'))
prog
.command('foo bar')
.describe('A subcommand')
.action(() => console.log('did a thing'))
```
Use case: the `foo` command doesn't do anything and requires usage of subcommands. As it is, doing `app foo --help` does not display any possible subcommands under the "Usage" section. Instead, one has to do `app --help` to see a potentially long list of available commands and subcommands. Ideally, `app --help` would show the `foo` command but not the `foo bar` command so that one would have to do `app foo --help` to see the available subcommands.
Side request: `foo` _could_ do something, but it'd just be an alias of a required subcommand.
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 tracing how command registration and help output handle the examples `foo` and `foo bar`. Check the output of `app --help` and `app foo --help`; done means the top-level help lists `foo` without `foo bar`, while the nested help lists the available subcommand.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100