当前位置: 动力学知识库 > 问答 > 编程问答 >

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?

网友答案:

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 >
分享给朋友:
您可能感兴趣的文章:
随机阅读: