Skip to content

Commit

Permalink
usage: specify the key each time for multiples
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
isaacs committed Apr 1, 2021
1 parent fb095a7 commit 48f14e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 48f14e9

Please sign in to comment.