Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clearTerminal to clear the whole terminal, not just visible part of it #6

Merged
merged 3 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ x.scrollUp = ESC + 'S';
x.scrollDown = ESC + 'T';

x.clearScreen = '\u001Bc';

// Extracted from Jest - https://github.com/facebook/jest/blob/1c56fb88f8527e25abffaa9de62c6e2476cdccc9/packages/jest-cli/src/constants.js#L12
x.clearTerminal = process.platform === 'win32' ? `${x.eraseScreen}${ESC}0f` : `${x.eraseScreen}${ESC}3J${ESC}H`;
sindresorhus marked this conversation as resolved.
Show resolved Hide resolved
x.beep = BEL;

x.link = (text, url) => {
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ Scroll display down one line.

Clear the terminal screen.

### clearTerminal

Clear the whole terminal, not just visible part of it.

### beep

Output a beeping sound.
Expand Down