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

Function cmdUsages

deps/npm/lib/utils/npm-usage.js:60–74  ·  view source on GitHub ↗
(Npm)

Source from the content-addressed store, hash-verified

58}
59
60const cmdUsages = (Npm) => {
61 // return a string of <command>: <usage>
62 let maxLen = 0
63 const set = []
64 for (const c of commands) {
65 set.push([c, Npm.cmd(c).getUsage(null, false).split('\n')])
66 maxLen = Math.max(maxLen, c.length)
67 }
68
69 return set.map(([name, usageLines]) => {
70 const gutter = indent(maxLen - name.length + 1)
71 const usage = usageLines.join(indentNewline(INDENT + maxLen + 1))
72 return indentNewline() + name + gutter + usage
73 }).join('\n')
74}

Callers 1

npm-usage.jsFile · 0.85

Calls 9

indentNewlineFunction · 0.85
getUsageMethod · 0.80
cmdMethod · 0.80
indentFunction · 0.70
mapMethod · 0.65
pushMethod · 0.45
splitMethod · 0.45
maxMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…