MCPcopy Index your code
hub / github.com/nodejs/node / completion

Method completion

deps/npm/lib/commands/help.js:29–44  ·  view source on GitHub ↗
(opts, npm)

Source from the content-addressed store, hash-verified

27 static params = ['viewer']
28
29 static async completion (opts, npm) {
30 if (opts.conf.argv.remain.length > 2) {
31 return []
32 }
33 const g = path.resolve(npm.npmRoot, 'man/man[0-9]/*.[0-9]')
34 let files = await glob(globify(g))
35 // preserve glob@8 behavior
36 files = files.sort((a, b) => a.localeCompare(b, 'en'))
37
38 return Object.keys(files.reduce(function (acc, file) {
39 file = path.basename(file).replace(/\.[0-9]+$/, '')
40 file = file.replace(/^npm-/, '')
41 acc[file] = true
42 return acc
43 }, { help: true }))
44 }
45
46 async exec (args) {
47 // By default we search all of our man subdirectories, but if the user has asked for a specific one we limit the search to just there

Callers

nothing calls this directly

Calls 6

sortMethod · 0.80
reduceMethod · 0.80
globifyFunction · 0.70
keysMethod · 0.65
globFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected