From 0f79e708bf07721b73ea41e5d341be08e8ea4dce Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 7 Mar 2021 18:29:17 +0100 Subject: Initial commit --- node_modules/cli-cursor/index.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 node_modules/cli-cursor/index.js (limited to 'node_modules/cli-cursor/index.js') diff --git a/node_modules/cli-cursor/index.js b/node_modules/cli-cursor/index.js new file mode 100644 index 0000000..710c405 --- /dev/null +++ b/node_modules/cli-cursor/index.js @@ -0,0 +1,35 @@ +'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); + } +}; -- cgit