'line' 事件
每当 input 流接收到行尾输入(\n、\r 或 \r\n)时,则会触发 'line' 事件。
这通常发生在用户按下 回车 或 返回 时。
使用包含单行接收输入的字符串调用监听器函数。
rl.on('line', (input) => {
console.log(`Received: ${input}`);
});The 'line' event is emitted whenever the input stream receives an
end-of-line input (\n, \r, or \r\n). This usually occurs when the user
presses Enter or Return.
The listener function is called with a string containing the single line of received input.
rl.on('line', (input) => {
console.log(`Received: ${input}`);
});