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
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-03-24 17:18:56 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-03-28 23:21:36 +0300
commitd8dcc02cfd354c1314c45d6530ec926cd138210c (patch)
treeba3721d4c4f153fe005bf9e08d450d9e2473a9a4 /lib/commands
parenta64acc0bf01e4bc68b26ead5b2d5c6db47ef16c2 (diff)
fix: consolidate command alias code
Diffstat (limited to 'lib/commands')
-rw-r--r--lib/commands/completion.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/commands/completion.js b/lib/commands/completion.js
index 0317753a1..22f91b0ae 100644
--- a/lib/commands/completion.js
+++ b/lib/commands/completion.js
@@ -30,7 +30,6 @@
//
const { definitions, shorthands } = require('../utils/config/index.js')
-const deref = require('../utils/deref-command.js')
const { aliases, cmdList, plumbing } = require('../utils/cmd-list.js')
const aliasNames = Object.keys(aliases)
const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c))
@@ -152,7 +151,7 @@ class Completion extends BaseCommand {
// check if there's a command already.
const cmd = parsed.argv.remain[1]
if (!cmd) {
- return this.wrap(opts, cmdCompl(opts))
+ return this.wrap(opts, cmdCompl(opts, this.npm))
}
Object.keys(parsed).forEach(k => this.npm.config.set(k, parsed[k]))
@@ -269,13 +268,13 @@ const isFlag = word => {
// complete against the npm commands
// if they all resolve to the same thing, just return the thing it already is
-const cmdCompl = opts => {
+const cmdCompl = (opts, npm) => {
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
if (!matches.length) {
return matches
}
- const derefs = new Set([...matches.map(c => deref(c))])
+ const derefs = new Set([...matches.map(c => npm.deref(c))])
if (derefs.size === 1) {
return [...derefs]
}