replServer.displayPrompt([preserveCursor])


replServer.displayPrompt() 方法使 REPL 实例准备好接收用户输入,在 output 中的新行打印配置的 prompt,并恢复 input 以接受新的输入。

【The replServer.displayPrompt() method readies the REPL instance for input from the user, printing the configured prompt to a new line in the output and resuming the input to accept new input.】

当输入多行内容时,会打印省略号,而不是“提示符”。

【When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'.】

preserveCursortrue 时,光标位置不会被重置为 0

【When preserveCursor is true, the cursor placement will not be reset to 0.】

replServer.displayPrompt 方法主要用于在通过 replServer.defineCommand() 方法注册的命令的操作函数中调用。

【The replServer.displayPrompt method is primarily intended to be called from within the action function for commands registered using the replServer.defineCommand() method.】