Command flag deprecated not well documented
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
yargs can mark command as deprecated. However, it's not documented and it may be tricky.
Documentation
Positional and object arguments are described neither in https://yargs.js.org/docs/#api-reference-commandcmd-desc-builder-handler nor in https://github.com/yargs/yargs/blob/main/docs/advanced.md#commands The deprecated and middleware options are missing completely. It would be nice to have same doc like for the options https://yargs.js.org/docs/#api-reference-optionkey-opt
Usage
Object parameter is working OK:
.command({command: 'cmd', description: 'Do command', deprecated: true})
(Just .options() takes also deprecate property, too)
Positional argument is necessary to specify as:
.command('cmd', 'Do command', {}, () => {}, [], true)
Because neither of these is working:
.command('cmd', 'Do command', true) // Error: Invalid third argument. Expected function or object but received boolean.
.command('cmd', 'Do command', undefined, undefined, undefined, true) // Error: TypeError: t.map is not a function
Contributor guide
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 with docs/advanced.md and the linked command API reference, then compare their structure with the option API documentation. Document positional and object command arguments, including deprecated and middleware options, and verify that the examples match the supported command signatures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100