yargs / yargs/yargs

Command flag deprecated not well documented

Open
#2,246 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.