Skip to content

Commit

Permalink
chore: Fix usage text for embedded mode
Browse files Browse the repository at this point in the history
Fixes: nodejs#19
  • Loading branch information
addaleax committed Feb 11, 2017
1 parent dbb983a commit b0779f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/_inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ const { spawn } = require('child_process');
const { EventEmitter } = require('events');
const util = require('util');

const runAsStandalone = typeof __dirname !== 'undefined';

const [ InspectClient, createRepl ] =
(typeof __dirname !== 'undefined') ?
runAsStandalone ?
// This copy of node-inspect is on-disk, relative paths make sense.
[
require('./internal/inspect_client'),
Expand Down Expand Up @@ -258,8 +260,12 @@ function startInspect(argv = process.argv.slice(2),
stdout = process.stdout) {
/* eslint-disable no-console */
if (argv.length < 1) {
console.error('Usage: node-inspect script.js');
console.error(' node-inspect <host>:<port>');
const invokedAs = runAsStandalone ?
'node-inspect' :
`${process.argv0} ${process.argv[1]}`;

console.error(`Usage: ${invokedAs} script.js`);
console.error(` ${invokedAs} <host>:<port>`);
process.exit(1);
}

Expand Down

0 comments on commit b0779f5

Please sign in to comment.