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

Function getCustomDefinitions

deps/npm/lib/commands/completion.js:214–238  ·  view source on GitHub ↗
(cmd, subCmd)

Source from the content-addressed store, hash-verified

212
213// Helper to get custom definitions from a command/subcommand
214const getCustomDefinitions = (cmd, subCmd) => {
215 if (!cmd) {
216 return []
217 }
218
219 try {
220 const command = Npm.cmd(cmd)
221
222 // Check if the command has subcommands
223 if (subCmd && command.subcommands && command.subcommands[subCmd]) {
224 const subcommand = command.subcommands[subCmd]
225 // All subcommands have definitions
226 return subcommand.definitions
227 }
228
229 // Check if the command itself has definitions
230 if (command.definitions) {
231 return command.definitions
232 }
233 } catch {
234 // Command not found or no definitions
235 }
236
237 return []
238}
239
240// Helper to get all config names including aliases from custom definitions
241const getCustomConfigNames = (customDefs) => {

Callers 2

configComplFunction · 0.85
isFlagFunction · 0.85

Calls 1

cmdMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…