Cannot lazy parse and support `help`/`version` at same time
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/lukeed/sade/blob/1cdf3e464ca899dcd6e758a50eb82cf7cf484771/src/index.js#L150-L152
The early return here will break the following:
```js
const prog = sade('cool-cli', true).version('1.0.0').describe('Some cool CLI.')
const {args} = prog.parse(process.argv, {lazy: true})
if (args.something) {
// do stuff
}
```
This is inconsistent with the documentation:
https://github.com/lukeed/sade/blob/1cdf3e464ca899dcd6e758a50eb82cf7cf484771/readme.md?plain=1#L638-L653
One solution may be to return:
```js
{
args: [],
name: '',
handler: undefined,
helpOrVersion: true // indicates the user passed one of the options
}
```
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 at src/index.js lines 150-152 and compare the lazy parsing behavior with the documented contract in readme.md lines 638-653. Reproduce the example using version, describe, and parse(..., {lazy: true}); done means help/version options no longer trigger the early-return inconsistency and the lazy parse result exposes the needed state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100