add a small Tput.print helper function.

This commit is contained in:
Christopher Jeffrey 2015-08-06 00:13:03 -07:00
parent 45b180174f
commit 0547509481
2 changed files with 18 additions and 11 deletions

View File

@ -1227,6 +1227,16 @@ Tput.prototype._print = function(code, print, done) {
})();
};
// A small helper function if we want
// to easily output text with setTimeouts.
Tput.print = function() {
var fake = {
padding: true,
bools: { needs_xon_xoff: true, xon_xoff: false }
};
return Tput.prototype._print.apply(fake, arguments);
};
/**
* Termcap
*/

View File

@ -107,17 +107,14 @@ if (argv[0] === 'all') {
result = result.trim().toLowerCase();
if (result !== 'y') return process.exit(0);
console.log('\x1b[32m(You bet your ass I wish to proceed.)\x1b[m');
// tput._write('$<1000/>.$<1000/>.$<1000/>.$<100/>Let\'s go...',
// process.stdout.write.bind(process.stdout),
// function() {});
setTimeout(function() { process.stdout.write('.'); }, 1000);
setTimeout(function() { process.stdout.write('.'); }, 2000);
setTimeout(function() { process.stdout.write('.'); }, 3000);
setTimeout(function() { console.log('Let\'s go...'); }, 3100);
setTimeout(function() {
tput.compileAll(argv[1]);
process.exit(0);
}, 4000);
blessed.tput.print(
'$<1000/>.$<1000/>.$<1000/>.$<100/>Let\'s go...',
process.stdout.write.bind(process.stdout),
function() {
tput.compileAll(argv[1]);
process.exit(0);
}
);
});
return;