diff options
-rw-r--r-- | lib/bugs.js | 2 | ||||
-rw-r--r-- | lib/ci.js | 2 | ||||
-rw-r--r-- | lib/dedupe.js | 2 | ||||
-rw-r--r-- | lib/docs.js | 2 | ||||
-rw-r--r-- | lib/find-dupes.js | 2 | ||||
-rw-r--r-- | lib/outdated.js | 2 | ||||
-rw-r--r-- | lib/prune.js | 2 | ||||
-rw-r--r-- | lib/repo.js | 2 | ||||
-rw-r--r-- | lib/shrinkwrap.js | 2 | ||||
-rw-r--r-- | lib/utils/completion/none.js | 2 | ||||
-rw-r--r-- | test/lib/utils/completion/none.js | 6 |
11 files changed, 17 insertions, 9 deletions
diff --git a/lib/bugs.js b/lib/bugs.js index 55f81989a..85b975758 100644 --- a/lib/bugs.js +++ b/lib/bugs.js @@ -7,7 +7,7 @@ const npm = require('./npm.js') const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const usage = usageUtil('bugs', 'npm bugs [<pkgname>]') -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => bugs(args).then(() => cb()).catch(cb) @@ -10,7 +10,7 @@ const usageUtil = require('./utils/usage.js') const usage = usageUtil('ci', 'npm ci') -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => ci().then(() => cb()).catch(cb) diff --git a/lib/dedupe.js b/lib/dedupe.js index b6ee90c20..364234419 100644 --- a/lib/dedupe.js +++ b/lib/dedupe.js @@ -5,7 +5,7 @@ const usageUtil = require('./utils/usage.js') const reifyOutput = require('./utils/reify-output.js') const usage = usageUtil('dedupe', 'npm dedupe') -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => dedupe(args).then(() => cb()).catch(cb) diff --git a/lib/docs.js b/lib/docs.js index 4a1dbf7ed..e101f8fea 100644 --- a/lib/docs.js +++ b/lib/docs.js @@ -7,7 +7,7 @@ const npm = require('./npm.js') const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const usage = usageUtil('docs', 'npm docs [<pkgname> [<pkgname> ...]]') -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => docs(args).then(() => cb()).catch(cb) diff --git a/lib/find-dupes.js b/lib/find-dupes.js index 916e0f86e..bb0e91ecf 100644 --- a/lib/find-dupes.js +++ b/lib/find-dupes.js @@ -3,7 +3,7 @@ const dedupe = require('./dedupe.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('find-dupes', 'npm find-dupes') -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => dedupe({ dryRun: true } , cb) module.exports = Object.assign(cmd, { usage, completion }) diff --git a/lib/outdated.js b/lib/outdated.js index 68a6033b8..04a1a7e3c 100644 --- a/lib/outdated.js +++ b/lib/outdated.js @@ -19,7 +19,7 @@ const ansiTrim = require('./utils/ansi-trim.js') const usage = usageUtil('outdated', 'npm outdated [[<@scope>/]<pkg> ...]' ) -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') function cmd (args, cb) { outdated(args, cb) diff --git a/lib/prune.js b/lib/prune.js index 8db922010..8dc53a25c 100644 --- a/lib/prune.js +++ b/lib/prune.js @@ -8,7 +8,7 @@ const reifyOutput = require('./utils/reify-output.js') const usage = usageUtil('prune', 'npm prune [[<@scope>/]<pkg>...] [--production]' ) -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => prune().then(() => cb()).catch(cb) diff --git a/lib/repo.js b/lib/repo.js index 455ca9f33..7b415ee23 100644 --- a/lib/repo.js +++ b/lib/repo.js @@ -8,7 +8,7 @@ const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const { URL } = require('url') const usage = usageUtil('repo', 'npm repo [<pkgname> [<pkgname> ...]]') -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const cmd = (args, cb) => repo(args).then(() => cb()).catch(cb) diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index a6ff26be0..ec759578c 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -7,7 +7,7 @@ const log = require('npmlog') const cmd = (args, cb) => shrinkwrap().then(() => cb()).catch(cb) -const completion = (opts, cb) => cb(null, []) +const completion = require('./utils/completion/none.js') const shrinkwrap = async () => { // if has a npm-shrinkwrap.json, nothing to do diff --git a/lib/utils/completion/none.js b/lib/utils/completion/none.js new file mode 100644 index 000000000..752400da4 --- /dev/null +++ b/lib/utils/completion/none.js @@ -0,0 +1,2 @@ +// used for commands where no completion is relevant/possible +module.exports = (opts, cb) => cb(null, []) diff --git a/test/lib/utils/completion/none.js b/test/lib/utils/completion/none.js new file mode 100644 index 000000000..27f713b81 --- /dev/null +++ b/test/lib/utils/completion/none.js @@ -0,0 +1,6 @@ +const t = require('tap') +const none = require('../../../../lib/utils/completion/none.js') +none({any:'thing'}, (er, res) => { + t.equal(er, null) + t.strictSame(res, []) +}) |