Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit b0779f5

Browse files
committed
chore: Fix usage text for embedded mode
Fixes: #19
1 parent dbb983a commit b0779f5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/_inspect.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ const { spawn } = require('child_process');
2424
const { EventEmitter } = require('events');
2525
const util = require('util');
2626

27+
const runAsStandalone = typeof __dirname !== 'undefined';
28+
2729
const [ InspectClient, createRepl ] =
28-
(typeof __dirname !== 'undefined') ?
30+
runAsStandalone ?
2931
// This copy of node-inspect is on-disk, relative paths make sense.
3032
[
3133
require('./internal/inspect_client'),
@@ -258,8 +260,12 @@ function startInspect(argv = process.argv.slice(2),
258260
stdout = process.stdout) {
259261
/* eslint-disable no-console */
260262
if (argv.length < 1) {
261-
console.error('Usage: node-inspect script.js');
262-
console.error(' node-inspect <host>:<port>');
263+
const invokedAs = runAsStandalone ?
264+
'node-inspect' :
265+
`${process.argv0} ${process.argv[1]}`;
266+
267+
console.error(`Usage: ${invokedAs} script.js`);
268+
console.error(` ${invokedAs} <host>:<port>`);
263269
process.exit(1);
264270
}
265271

0 commit comments

Comments
 (0)