Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
617 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | const restoreCursor = require('restore-cursor');
|
---|
3 |
|
---|
4 | let isHidden = false;
|
---|
5 |
|
---|
6 | exports.show = (writableStream = process.stderr) => {
|
---|
7 | if (!writableStream.isTTY) {
|
---|
8 | return;
|
---|
9 | }
|
---|
10 |
|
---|
11 | isHidden = false;
|
---|
12 | writableStream.write('\u001B[?25h');
|
---|
13 | };
|
---|
14 |
|
---|
15 | exports.hide = (writableStream = process.stderr) => {
|
---|
16 | if (!writableStream.isTTY) {
|
---|
17 | return;
|
---|
18 | }
|
---|
19 |
|
---|
20 | restoreCursor();
|
---|
21 | isHidden = true;
|
---|
22 | writableStream.write('\u001B[?25l');
|
---|
23 | };
|
---|
24 |
|
---|
25 | exports.toggle = (force, writableStream) => {
|
---|
26 | if (force !== undefined) {
|
---|
27 | isHidden = force;
|
---|
28 | }
|
---|
29 |
|
---|
30 | if (isHidden) {
|
---|
31 | exports.show(writableStream);
|
---|
32 | } else {
|
---|
33 | exports.hide(writableStream);
|
---|
34 | }
|
---|
35 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.