Nick
Nick

Reputation: 9051

How to change the repl prompt of node.js?

node.js's default repl prompt is >, I sometimes type shell commands into it. In order to easily distinguish it from other programming language repl's and shell prompts, I would like to change it to something like node >. Is it possible, or is there any better practice on this problem?

Upvotes: 0

Views: 374

Answers (1)

user663031
user663031

Reputation:

Create a small node program which fires up a REPL and specifies prompt: 'node >' in the options hash.

See docs here.

// repl.js
const repl = require('repl');
var replServer = repl.start({prompt: 'node > '});

$ node repl.js
node >

Upvotes: 1

Related Questions