How to use the terminal-kit.terminal.restoreCursor function in terminal-kit

To help you get started, we’ve selected a few terminal-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oodavid / puppeteer-scraper / app / hud / progress.js View on Github external
const started = moment(session.started).format('D MMM HH:mm');
  const completed = session.newlyCompleted.toLocaleString();
  var ttc = '---';
  if(session.eta){
    ttc = moment().to(moment(session.eta), true);
  }
  var rate = '---';
  if(session.velocity){
    rate = Math.round((60*60*1000)/session.velocity).toLocaleString() + ' / hour';
  }
  var str = `^-Started: ^:${started} ^-Completed: ^:${completed} ^-Rate: ^:${rate} ^-TTC: ^:${ttc}`;
  // Output
  term.restoreCursor();
  term.column(0).move(0, 4-numLines).eraseLine();
  term(str);
  term.restoreCursor();
}
github oodavid / puppeteer-scraper / app / hud / progress.js View on Github external
function showProgressMeter(){
  // The meter
  var len = 70;
  var left = Array(Math.round(len*session.pctComplete)).join('=');
  var right = Array(1+len-Math.round(len*session.pctComplete)).join('-');
  var completed = session.completed.toLocaleString();
  var total = session.total.toLocaleString();
  // The string
  var pctStr = Math.floor(session.pctComplete * 100);
  var str = `Progress [^g${left}^:^-${right}^:] ${pctStr}% [^g${completed}^: / ${total}]`;
  // Output
  term.restoreCursor();
  term.column(0).move(0, 3-numLines).eraseLine();
  term(str);
  term.restoreCursor();
}
github oodavid / puppeteer-scraper / app / hud / writeLine.js View on Github external
function writeLine(n, message){
  // Sanitize the message
  message = message.replace(/[\r\n]/g, ''); // Strip newlines
  message = message.substring(0, maxLength); // Clip the length
  // Write
  initOnce();
  term.restoreCursor();
  term.column(0).move(0, n-numLines).eraseLine();
  term(message);
  term.restoreCursor();
}
github sjurba / rebase-editor / lib / editor.js View on Github external
function status(stat) {
  if (showStatus) {
    term.saveCursor();
    term.moveTo.bgWhite.black(1, 1).eraseLine();
    term(stat);
    term.white.bgBlack();
    term.restoreCursor();
  }
}
github cronvel / terminal-kit / sample / single-column-menu-todoc2.js View on Github external
menu.on( 'submit' , data => {
	term.saveCursor() ;
	term.moveTo( 1 , term.height - 1 , "Submit: %s" , data.selectedText ) ;
	term.restoreCursor() ;
} ) ;
github msaari / 18sh / modules / statusBar.js View on Github external
})
	companyBarContent += barContentString

	term.moveTo(1, playerLines + 1)
	let companyLines = Math.ceil(companyBarContent.length / term.width)
	for (let line = 1; line <= companyLines; line += 1) {
		term.bgYellow()
		term.black()
		term(new Array(term.width + 1).join(" "))
		term.nextLine()
	}

	term.moveTo(1, playerLines + 1)
	term(companyBarContent)

	term.restoreCursor()
}