rl.prompt([preserveCursor])


  • preserveCursor <boolean> 如果 true,可以防止光标位置被重置为 0

rl.prompt() 方法会将 readline.Interface 实例所配置的 prompt 写入 output 的新一行,以便为用户提供一个新的位置来输入内容。

🌐 The rl.prompt() method writes the readline.Interface instances configured prompt to a new line in output in order to provide a user with a new location at which to provide input.

当被调用时,rl.prompt() 将会恢复已暂停的 input 流。

🌐 When called, rl.prompt() will resume the input stream if it has been paused.

如果使用 output 设置为 nullundefined 创建了 readline.Interface,则不会显示提示符。

🌐 If the readline.Interface was created with output set to null or undefined the prompt is not written.