Skip to content

Commit 48f14e9

Browse files
committed
usage: specify the key each time for multiples
If a user runs 'npm install -w foo bar baz', that won't set 'bar' and 'baz' as workspace names. The correct incantation is 'npm install -w foo -w bar -w baz'.
1 parent fb095a7 commit 48f14e9

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

docs/content/using-npm/config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ registry and all registries configured for scopes. See the documentation for
185185
#### `audit-level`
186186

187187
* Default: null
188-
* Type: "info", "low", "moderate", "high", "critical", "none", or null
188+
* Type: null, "info", "low", "moderate", "high", "critical", or "none"
189189

190190
The minimum level of vulnerability for `npm audit` to exit with a non-zero
191191
exit code.

lib/utils/config/definition.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ const describeUsage = (def) => {
116116
description = def.hint
117117
}
118118

119-
if (multiple)
120-
description = `${description} [${description} ...]`
121-
122119
if (bool)
123120
key = `${key}|${key}`
124121

125-
return `${key} ${description}`
122+
const usage = `${key} ${description}`
123+
if (multiple)
124+
return `${usage} [${usage} ...]`
125+
else
126+
return usage
126127
}
127128

128129
const describeType = type => {

tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ All commands:
335335
npm docs [<pkgname> [<pkgname> ...]]
336336
337337
Options:
338-
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
338+
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
339339
340340
alias: home
341341
@@ -370,7 +370,7 @@ All commands:
370370
npm exec --package=foo -c '<cmd> [args...]'
371371
372372
Options:
373-
[-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
373+
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
374374
375375
alias: x
376376
@@ -702,7 +702,7 @@ All commands:
702702
npm repo [<pkgname> [<pkgname> ...]]
703703
704704
Options:
705-
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
705+
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
706706
707707
Run "npm help repo" for more info
708708
@@ -735,7 +735,7 @@ All commands:
735735
npm run-script <command> [-- <args>]
736736
737737
Options:
738-
[-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
738+
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
739739
740740
aliases: run, rum, urn
741741
@@ -772,7 +772,7 @@ All commands:
772772
npm set-script [<script>] [<command>]
773773
774774
Options:
775-
[-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
775+
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
776776
777777
Run "npm help set-script" for more info
778778
@@ -921,7 +921,7 @@ All commands:
921921
npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]
922922
923923
Options:
924-
[--json] [-w|--workspace <workspace-name> [<workspace-name> ...]] [-ws|--workspaces]
924+
[--json] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
925925
926926
aliases: v, info, show
927927

0 commit comments

Comments
 (0)