Ohm-Management - Projektarbeit B-ME
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.

index.js 553B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. const restoreCursor = require('restore-cursor');
  3. let hidden = false;
  4. exports.show = stream => {
  5. const s = stream || process.stderr;
  6. if (!s.isTTY) {
  7. return;
  8. }
  9. hidden = false;
  10. s.write('\u001b[?25h');
  11. };
  12. exports.hide = stream => {
  13. const s = stream || process.stderr;
  14. if (!s.isTTY) {
  15. return;
  16. }
  17. restoreCursor();
  18. hidden = true;
  19. s.write('\u001b[?25l');
  20. };
  21. exports.toggle = (force, stream) => {
  22. if (force !== undefined) {
  23. hidden = force;
  24. }
  25. if (hidden) {
  26. exports.show(stream);
  27. } else {
  28. exports.hide(stream);
  29. }
  30. };