This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/inquirer/lib/utils/readline.js
2019-08-11 20:48:02 +02:00

51 lines
1.2 KiB
JavaScript

'use strict';
var ansiEscapes = require('ansi-escapes');
/**
* Move cursor left by `x`
* @param {Readline} rl - Readline instance
* @param {Number} x - How far to go left (default to 1)
*/
exports.left = function (rl, x) {
rl.output.write(ansiEscapes.cursorBackward(x));
};
/**
* Move cursor right by `x`
* @param {Readline} rl - Readline instance
* @param {Number} x - How far to go left (default to 1)
*/
exports.right = function (rl, x) {
rl.output.write(ansiEscapes.cursorForward(x));
};
/**
* Move cursor up by `x`
* @param {Readline} rl - Readline instance
* @param {Number} x - How far to go up (default to 1)
*/
exports.up = function (rl, x) {
rl.output.write(ansiEscapes.cursorUp(x));
};
/**
* Move cursor down by `x`
* @param {Readline} rl - Readline instance
* @param {Number} x - How far to go down (default to 1)
*/
exports.down = function (rl, x) {
rl.output.write(ansiEscapes.cursorDown(x));
};
/**
* Clear current line
* @param {Readline} rl - Readline instance
* @param {Number} len - number of line to delete
*/
exports.clearLine = function (rl, len) {
rl.output.write(ansiEscapes.eraseLines(len));
};