I've a little node program that runs in terminal that asks users for input. After several user responses, the Make a selection: is pushed down to the bottom of the terminal.
Visually, I want to have maintain a few lines of space below where a user enters their choice. I want the person to input as if they are in the center of the terminal.
Is there a technique to do this?
User input - note: read() is called repeatedly but not shown here:
var stdin = process.stdin
, stdout = process.stdout;
function option (answer) {
// do something with answer
};
function read () {
console.log('');
stdout.write(' \033[33m Make a selection" \033[39m');
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', option);
};
Thanks.
Sorry if this is not a complete answer, but your one stop solution for making CLI programs with node.js is the commander npm package.