import java.lang.System.{currentTimeMillis, out => stdout};
import sys.isatty;
+import Implicits.truish;
/*----- Main code ---------------------------------------------------------*/
def clear() { note(""); }
def commit() {
- if (last != "") {
+ if (last) {
if (eyecandyp) stdout.write('\n');
else stdout.println(last);
last = "";
extends progress.JobReporter {
private final val width = 40;
private final val spinner = """/-\|""";
- private final val mingap = 100;
+ private final val mingap = 50;
private[this] var step: Int = 0;
private[this] var sweep: Int = 0;
private[this] val t0 = currentTimeMillis;
val max = model.max;
val sb = new StringBuilder;
- sb ++= model.what; sb += ' ';
+ sb ++= model.what; sb += ':'; sb += ' ';
/* Step the spinner. */
sb += spinner(step); sb += ' ';
sb += ']';
/* Quantitative progress. */
- val f = model.format(cur); if (f != "") { sb += ' '; sb ++= f; }
+ val f = model.format(cur); if (f) { sb += ' '; sb ++= f; }
if (max > 0) sb ++= (100*cur/max).formatted(" %3d%%");
/* Estimated time to completion. */
val eta = model.eta(cur);
if (eta >= 0) {
sb += ' '; sb += '(';
- sb ++= formatTime(ceil(eta/1000.0).toInt);
+ sb ++= formatDuration(ceil(eta/1000.0).toInt);
sb += ')';
}
}
def done() {
- val t = formatTime(ceil((currentTimeMillis - t0)/1000.0).toInt);
- record(s"${model.what} done ($t)");
+ val t = formatDuration(ceil((currentTimeMillis - t0)/1000.0).toInt);
+ record(s"${model.what}: done ($t)");
}
def failed(e: Exception)
- { record(s"${model.what} FAILED: ${e.getMessage}"); }
+ { record(s"${model.what}: FAILED: ${e.getMessage}"); }
step(0);
}