}
this._sawReturn = false;
- this._defaultPrompt = '> ';
EventEmitter.call(this);
callback(null, completer(v));
};
- this.setDefaultPrompt();
+ this.setPrompt('> ');
this.terminal = !!terminal;
this._prompt = prompt;
};
-Interface.prototype.setDefaultPrompt = function(prompt) {
- if (!util.isUndefined(prompt))
- this._defaultPrompt = prompt;
- this._prompt = this._defaultPrompt;
-};
Interface.prototype._setRawMode = function(mode) {
if (util.isFunction(this.input.setRawMode)) {
options.terminal
]);
- self.setDefaultPrompt(prompt);
+ self.setPrompt(!util.isUndefined(prompt) ? prompt : '> ');
this.commands = {};
defineDefaultCommands(this);
};
REPLServer.prototype.displayPrompt = function(preserveCursor) {
- var prompt = this._prompt;
+ var initial = this._prompt;
+ var prompt = initial;
if (this.bufferedCommand.length) {
prompt = '...';
var levelInd = new Array(this.lines.level.length).join('..');
prompt += levelInd + ' ';
- this.setPrompt(prompt);
- } else {
- this.setDefaultPrompt();
}
+ this.setPrompt(prompt);
this.prompt(preserveCursor);
+ this.setPrompt(initial);
};
// A stream to push an array into a REPL
'node repl, in your normal shell.\n' +
'(Press Control-D to exit.)\n',
expect_npm = prompt_npm + prompt_unix,
- server_tcp, server_unix, client_tcp, client_unix, timer,
- repl_unix;
+ server_tcp, server_unix, client_tcp, client_unix, timer;
// absolute path to test/fixtures/a.js
} else if (read_buffer.indexOf(prompt_multiline) !== -1) {
// Check that you meant to send a multiline test
assert.strictEqual(prompt_multiline, client_unix.expect);
- assert.equal(repl_unix._prompt, prompt_multiline);
read_buffer = '';
if (client_unix.list && client_unix.list.length > 0) {
send_expect(client_unix.list);
socket.end();
});
- repl_unix = repl.start({
+ repl.start({
prompt: prompt_unix,
input: socket,
output: socket,
useGlobal: true
- });
- repl_unix.context.message = message;
+ }).context.message = message;
});
server_unix.on('listening', function() {