(args)
| 289 | // { mode: 'probe', tokens, args } |
| 290 | // { mode: 'interactive' } |
| 291 | function 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 | |
| 320 | function startInspect(argv = ArrayPrototypeSlice(process.argv, 2), |
| 321 | stdin = process.stdin, |
no outgoing calls
no test coverage detected
searching dependent graphs…