Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2021-04-01 22:10:15 +0300
committerGar <gar+gh@danger.computer>2021-04-01 22:18:10 +0300
commit4c4252348c538246e1072421d65f4558dc948080 (patch)
treec48366e176626bb85ff07b848c9022e51a1964cb /lib
parentfb095a708a1f930bbd0195446ac611b82bfeff14 (diff)
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'. PR-URL: https://github.com/npm/cli/pull/3016 Credit: @isaacs Close: #3016 Reviewed-by: @wraithgar
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/config/definition.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/utils/config/definition.js b/lib/utils/config/definition.js
index e7c605fb7..5ec2ba1ab 100644
--- a/lib/utils/config/definition.js
+++ b/lib/utils/config/definition.js
@@ -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 => {