Browse Source

doc: fix repl defineCommand example

Fixes: https://github.com/nodejs/node/issues/7357
PR-URL: https://github.com/nodejs/node/pull/7365
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
akki 9 years ago
committed by Jeremiah Senkpiel
parent
commit
a04cd85667
  1. 4
      doc/api/repl.md

4
doc/api/repl.md

@ -312,12 +312,12 @@ replServer.defineCommand('sayhello', {
action: function(name) { action: function(name) {
this.lineParser.reset(); this.lineParser.reset();
this.bufferedCommand = ''; this.bufferedCommand = '';
this.write(`Hello, ${name}!\n`); console.log(`Hello, ${name}!`);
this.displayPrompt(); this.displayPrompt();
} }
}); });
replServer.defineCommand('saybye', function() { replServer.defineCommand('saybye', function() {
this.write('Goodbye!\n'); console.log('Goodbye!');
this.close(); this.close();
}); });
``` ```

Loading…
Cancel
Save