X-Git-Url: https://git.distorted.org.uk/~mdw/tripe-android/blobdiff_plain/a5ec891a1f3cbe4ae9aad5d2252f39b483ed543e..HEAD:/terminal.scala diff --git a/terminal.scala b/terminal.scala index 7ca56d3..2e66aa2 100644 --- 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 Implicits.truish; /*----- Main code ---------------------------------------------------------*/ @@ -78,7 +79,7 @@ object TerminalEyecandy extends Eyecandy { def clear() { note(""); } def commit() { - if (last != "") { + if (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 = """/-\|"""; - 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; @@ -114,7 +115,7 @@ object TerminalEyecandy extends Eyecandy { val max = model.max; val sb = new StringBuilder; - sb ++= model.what; sb += ' '; + sb ++= model.what; sb += ':'; sb += ' '; /* Step the spinner. */ sb += spinner(step); sb += ' '; @@ -140,7 +141,7 @@ object TerminalEyecandy extends Eyecandy { 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. */ @@ -157,11 +158,11 @@ object TerminalEyecandy extends Eyecandy { 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) - { record(s"${model.what} FAILED: ${e.getMessage}"); } + { record(s"${model.what}: FAILED: ${e.getMessage}"); } step(0); }