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

Method exec

deps/npm/lib/commands/help-search.js:15–32  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

13 static params = ['long']
14
15 async exec (args) {
16 if (!args.length) {
17 throw this.usageError()
18 }
19
20 const docPath = path.resolve(this.npm.npmRoot, 'docs/content')
21 let files = await glob(`${globify(docPath)}/*/*.md`)
22 // preserve glob@8 behavior
23 files = files.sort((a, b) => a.localeCompare(b, 'en'))
24 const data = await this.readFiles(files)
25 const results = await this.searchFiles(args, data)
26 const formatted = this.formatResults(args, results)
27 if (!formatted.trim()) {
28 output.standard(`No matches in help for: ${args.join(' ')}\n`)
29 } else {
30 output.standard(formatted)
31 }
32 }
33
34 async readFiles (files) {
35 const res = {}

Callers

nothing calls this directly

Calls 9

readFilesMethod · 0.95
searchFilesMethod · 0.95
formatResultsMethod · 0.95
usageErrorMethod · 0.80
sortMethod · 0.80
globifyFunction · 0.70
globFunction · 0.50
resolveMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected