chiark
/
gitweb
/
~mdw
/
tripe-android
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
keys.scala, etc.: Make merging public keys have a progress bar.
[tripe-android]
/
terminal.scala
diff --git
a/terminal.scala
b/terminal.scala
index 7ca56d3fcbae93def7ffa42faad6317b1ba0843d..2e66aa288dca70c099eb0ba0e73c73baea72f501 100644
(file)
--- a/
terminal.scala
+++ b/
terminal.scala
@@
-32,6
+32,7
@@
import java.lang.Math.ceil;
import java.lang.System.{currentTimeMillis, out => stdout};
import sys.isatty;
import java.lang.System.{currentTimeMillis, out => stdout};
import sys.isatty;
+import Implicits.truish;
/*----- Main code ---------------------------------------------------------*/
/*----- Main code ---------------------------------------------------------*/
@@
-78,7
+79,7
@@
object TerminalEyecandy extends Eyecandy {
def clear() { note(""); }
def commit() {
def clear() { note(""); }
def commit() {
- if (last
!= ""
) {
+ if (last) {
if (eyecandyp) stdout.write('\n');
else stdout.println(last);
last = "";
if (eyecandyp) stdout.write('\n');
else stdout.println(last);
last = "";
@@
-98,7
+99,7
@@
object TerminalEyecandy extends Eyecandy {
extends progress.JobReporter {
private final val width = 40;
private final val spinner = """/-\|""";
extends progress.JobReporter {
private final val width = 40;
private final val spinner = """/-\|""";
- private final val mingap =
10
0;
+ private final val mingap =
5
0;
private[this] var step: Int = 0;
private[this] var sweep: Int = 0;
private[this] val t0 = currentTimeMillis;
private[this] var step: Int = 0;
private[this] var sweep: Int = 0;
private[this] val t0 = currentTimeMillis;
@@
-114,7
+115,7
@@
object TerminalEyecandy extends Eyecandy {
val max = model.max;
val sb = new StringBuilder;
val max = model.max;
val sb = new StringBuilder;
- sb ++= model.what; sb += ' ';
+ sb ++= model.what; sb += '
:'; sb += '
';
/* Step the spinner. */
sb += spinner(step); sb += ' ';
/* Step the spinner. */
sb += spinner(step); sb += ' ';
@@
-140,7
+141,7
@@
object TerminalEyecandy extends Eyecandy {
sb += ']';
/* Quantitative progress. */
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. */
if (max > 0) sb ++= (100*cur/max).formatted(" %3d%%");
/* Estimated time to completion. */
@@
-157,11
+158,11
@@
object TerminalEyecandy extends Eyecandy {
def done() {
val t = formatDuration(ceil((currentTimeMillis - t0)/1000.0).toInt);
def done() {
val t = formatDuration(ceil((currentTimeMillis - t0)/1000.0).toInt);
- record(s"${model.what} done ($t)");
+ record(s"${model.what}
:
done ($t)");
}
def failed(e: Exception)
}
def failed(e: Exception)
- { record(s"${model.what} FAILED: ${e.getMessage}"); }
+ { record(s"${model.what}
:
FAILED: ${e.getMessage}"); }
step(0);
}
step(0);
}