diff --git a/build.gradle b/build.gradle index 1c0b19f..b146926 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: "groovy" apply plugin: "maven" group = "com.jdbernard" -version = "3.5" +version = "3.6" repositories { mavenCentral() } diff --git a/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy b/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy index 7f6a399..94876e9 100644 --- a/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy +++ b/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy @@ -42,13 +42,16 @@ class ConsoleProgressBar { def remMin = curPercent < 0.05 ? '?' : (int) (remTime / 60) def remSec = curPercent < 0.05 ? '?' : (int) (((remTime / 60.0) - remMin) * 60) + lastInfo = info + if (info.length() > 16) info = info[0..<16] + if (info.length() < 16) info = info.padRight(16) + out.print '\b' * lastLinePrinted.length() lastLinePrinted = '=' * numEq + (curStep > 0 ? "0" : "") + '-' * (MAX_STEP - curStep) - lastLinePrinted += " ${info.padRight(16)} -- (" + + lastLinePrinted += " ${info} -- (" + "${String.format('%5.2f', curPercent * 100)}%, ${remMin ? remMin + 'm ' : ''}${remSec}s) " out.print lastLinePrinted lastStepAmount = curStep; - lastInfo = info } out.flush() }