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

Function parseInspectMode

lib/internal/debugger/inspect.js:291–318  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

289// { mode: 'probe', tokens, args }
290// { mode: 'interactive' }
291function parseInspectMode(args) {
292 const { tokens } = util.parseArgs({
293 args,
294 allowPositionals: true,
295 options: kInspectArgOptions,
296 strict: false,
297 tokens: true,
298 });
299
300 for (const token of tokens) {
301 if (token.kind === 'option') {
302 if (token.name === 'help') return { mode: 'help' };
303 if (token.name === 'probe') {
304 // `--probe --help` / `--probe -h` (no value) consumes the help flag
305 // as the probe's "value"; surface help instead of a probe error.
306 if (!token.inlineValue &&
307 (token.value === '--help' || token.value === '-h')) {
308 return { mode: 'help' };
309 }
310 return { mode: 'probe', tokens, args };
311 }
312 }
313 if (token.kind === 'option-terminator' || token.kind === 'positional') {
314 break;
315 }
316 }
317 return { mode: 'interactive' };
318}
319
320function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
321 stdin = process.stdin,

Callers 1

startInspectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…