rl.prompt([preserveCursor])


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

rl.prompt() 方法将配置为 promptreadline.Interface 实例写入 output 中的新行,以便为用户提供用于提供输入的新位置。

当调用时,如果 rl.prompt() 流已暂停,则 rl.prompt() 将恢复 input 流。

如果 readline.Interface 是在 output 设置为 nullundefined 的情况下创建的,则不会写入提示。

  • preserveCursor <boolean> If true, prevents the cursor placement from being reset to 0.

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.

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

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