rl.clearLine(dir)


  • dir <integer>
    • -1:光标左侧
    • 1: 从光标向右
    • 0:整行
  • 返回值:this

rl.clearLine() 方法会向内部待处理操作列表添加一个操作,该操作会按照 dir 指定的方向清除关联 stream 的当前行。除非在构造函数中传入了 autoCommit: true,否则需要调用 rl.commit() 才能看到此方法的效果。

【The rl.clearLine() method adds to the internal list of pending action an action that clears current line of the associated stream in a specified direction identified by dir. Call rl.commit() to see the effect of this method, unless autoCommit: true was passed to the constructor.】