Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
617 B
36 lines
617 B
1 year ago
|
'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);
|
||
|
}
|
||
|
};
|