mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
36 lines
617 B
JavaScript
36 lines
617 B
JavaScript
'use strict';
|
|
const restoreCursor = require('restore-cursor');
|
|
|
|
let isHidden = false;
|
|
|
|
exports.show = (writableStream = process.stderr) => {
|
|
if (!writableStream.isTTY) {
|
|
return;
|
|
}
|
|
|
|
isHidden = false;
|
|
writableStream.write('\u001B[?25h');
|
|
};
|
|
|
|
exports.hide = (writableStream = process.stderr) => {
|
|
if (!writableStream.isTTY) {
|
|
return;
|
|
}
|
|
|
|
restoreCursor();
|
|
isHidden = true;
|
|
writableStream.write('\u001B[?25l');
|
|
};
|
|
|
|
exports.toggle = (force, writableStream) => {
|
|
if (force !== undefined) {
|
|
isHidden = force;
|
|
}
|
|
|
|
if (isHidden) {
|
|
exports.show(writableStream);
|
|
} else {
|
|
exports.hide(writableStream);
|
|
}
|
|
};
|