Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command flag deprecated not well documented #2246

Open
xmedeko opened this issue Oct 11, 2022 · 1 comment
Open

Command flag deprecated not well documented #2246

xmedeko opened this issue Oct 11, 2022 · 1 comment
Labels

Comments

@xmedeko
Copy link

xmedeko commented Oct 11, 2022

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
@xmedeko xmedeko changed the title command flag deprecated not well documented Command flag deprecated not well documented Oct 11, 2022
@bcoe bcoe added the docs label Nov 3, 2022
@shadowspawn
Copy link
Member

Related: #1518 #1559 #1624

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants