How draftlog works and terminal limitations
masterDraftlog works by tracking the current lines written through the stream and moving the terminal cursor up to the specific line of a previously created LogDraft to update its content.
Key Concepts & Limitations:
- Viewport Limits: It is not possible to update text that has scrolled outside the visible area of the terminal.
- Automatic Rewriting: If a DraftLog reaches the end of the terminal viewport, it is configured to automatically rewrite on a new line. You can disable this by setting
DraftLog.defaults.canReWrite = false. - Terminal Height: If Node.js cannot detect the terminal rows, it uses
DraftLog.defaults.maximumLinesUp. This can be modified if needed. - Process Exit: When using
.addLineListener(process.stdin), the process will not exit automatically becausestdinis being read. You must callprocess.exit(0)orprocess.stdin.pause()to stop the process.