rl.prompt([preserveCursor])


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

rl.prompt() 方法会将配置好的 InterfaceConstructor 实例的 prompt 写到 output 的新行上,以便为用户提供新的输入位置。

【The rl.prompt() method writes the InterfaceConstructor 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 创建了 InterfaceConstructor,则不会写入提示。

【If the InterfaceConstructor was created with output set to null or undefined the prompt is not written.】