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.

readline.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. var ansiEscapes = require('ansi-escapes');
  3. /**
  4. * Move cursor left by `x`
  5. * @param {Readline} rl - Readline instance
  6. * @param {Number} x - How far to go left (default to 1)
  7. */
  8. exports.left = function(rl, x) {
  9. rl.output.write(ansiEscapes.cursorBackward(x));
  10. };
  11. /**
  12. * Move cursor right by `x`
  13. * @param {Readline} rl - Readline instance
  14. * @param {Number} x - How far to go left (default to 1)
  15. */
  16. exports.right = function(rl, x) {
  17. rl.output.write(ansiEscapes.cursorForward(x));
  18. };
  19. /**
  20. * Move cursor up by `x`
  21. * @param {Readline} rl - Readline instance
  22. * @param {Number} x - How far to go up (default to 1)
  23. */
  24. exports.up = function(rl, x) {
  25. rl.output.write(ansiEscapes.cursorUp(x));
  26. };
  27. /**
  28. * Move cursor down by `x`
  29. * @param {Readline} rl - Readline instance
  30. * @param {Number} x - How far to go down (default to 1)
  31. */
  32. exports.down = function(rl, x) {
  33. rl.output.write(ansiEscapes.cursorDown(x));
  34. };
  35. /**
  36. * Clear current line
  37. * @param {Readline} rl - Readline instance
  38. * @param {Number} len - number of line to delete
  39. */
  40. exports.clearLine = function(rl, len) {
  41. rl.output.write(ansiEscapes.eraseLines(len));
  42. };