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

usage: specify the key each time for multiples #3016

Merged
merged 1 commit into from Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/using-npm/config.md
Expand Up @@ -185,7 +185,7 @@ registry and all registries configured for scopes. See the documentation for
#### `audit-level`

* Default: null
* Type: "info", "low", "moderate", "high", "critical", "none", or null
* Type: null, "info", "low", "moderate", "high", "critical", or "none"

The minimum level of vulnerability for `npm audit` to exit with a non-zero
exit code.
Expand Down
9 changes: 5 additions & 4 deletions lib/utils/config/definition.js
Expand Up @@ -116,13 +116,14 @@ const describeUsage = (def) => {
description = def.hint
}

if (multiple)
description = `${description} [${description} ...]`

if (bool)
key = `${key}|${key}`

return `${key} ${description}`
const usage = `${key} ${description}`
if (multiple)
return `${usage} [${usage} ...]`
else
return usage
}

const describeType = type => {
Expand Down
12 changes: 6 additions & 6 deletions tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js
Expand Up @@ -335,7 +335,7 @@ All commands:
npm docs [<pkgname> [<pkgname> ...]]

Options:
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]

alias: home

Expand Down Expand Up @@ -370,7 +370,7 @@ All commands:
npm exec --package=foo -c '<cmd> [args...]'

Options:
[-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]

alias: x

Expand Down Expand Up @@ -702,7 +702,7 @@ All commands:
npm repo [<pkgname> [<pkgname> ...]]

Options:
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]

Run "npm help repo" for more info

Expand Down Expand Up @@ -735,7 +735,7 @@ All commands:
npm run-script <command> [-- <args>]

Options:
[-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]

aliases: run, rum, urn

Expand Down Expand Up @@ -772,7 +772,7 @@ All commands:
npm set-script [<script>] [<command>]

Options:
[-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]

Run "npm help set-script" for more info

Expand Down Expand Up @@ -921,7 +921,7 @@ All commands:
npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]

Options:
[--json] [-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
[--json] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]

aliases: v, info, show

Expand Down