Merged in v3.11
This commit is contained in:
commit
5ce1cfab88
@ -2,13 +2,15 @@ apply plugin: "groovy"
|
|||||||
apply plugin: "maven"
|
apply plugin: "maven"
|
||||||
|
|
||||||
group = "com.jdbernard"
|
group = "com.jdbernard"
|
||||||
version = "4.0"
|
version = "4.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral() }
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.codehaus.groovy:groovy-all:2.3.6'
|
compile localGroovy()
|
||||||
compile 'org.slf4j:slf4j-api:1.7.10'
|
compile 'org.slf4j:slf4j-api:1.7.10'
|
||||||
compile 'ch.qos.logback:logback-core:1.1.2'
|
compile 'ch.qos.logback:logback-core:1.1.2'
|
||||||
compile 'ch.qos.logback:logback-classic:1.1.2'
|
compile 'ch.qos.logback:logback-classic:1.1.2'
|
||||||
|
@ -11,17 +11,17 @@ package com.jdbernard.util
|
|||||||
class ConsoleProgressBar {
|
class ConsoleProgressBar {
|
||||||
int MAX_STEP = 30
|
int MAX_STEP = 30
|
||||||
|
|
||||||
int max = 10
|
long max = 10
|
||||||
def out = System.out
|
def out = System.out
|
||||||
private int lastStepAmount = -1
|
private int lastStepAmount = -1
|
||||||
private String lastLinePrinted = ""
|
private String lastLinePrinted = ""
|
||||||
private String lastInfo = ""
|
private String lastInfo = ""
|
||||||
private long startTime
|
private long startTime
|
||||||
|
|
||||||
public void setMax(int max) {
|
public void setMax(long max) {
|
||||||
this.max = Math.max(max, 1) }
|
this.max = Math.max(max, 1) }
|
||||||
|
|
||||||
void update(int value, String info) {
|
void update(long value, String info) {
|
||||||
if (value == 0 || startTime == 0)
|
if (value == 0 || startTime == 0)
|
||||||
startTime = System.currentTimeMillis()
|
startTime = System.currentTimeMillis()
|
||||||
|
|
||||||
@ -43,8 +43,8 @@ class ConsoleProgressBar {
|
|||||||
remTime /= 1000
|
remTime /= 1000
|
||||||
|
|
||||||
def numEq = Math.max(curStep - 1, 0)
|
def numEq = Math.max(curStep - 1, 0)
|
||||||
def remMin = curPercent < 0.05 ? '?' : (int) (remTime / 60)
|
def remMin = curPercent < 0.05 ? '?' : (long) (remTime / 60)
|
||||||
def remSec = curPercent < 0.05 ? '?' : (int) (((remTime / 60.0) - remMin) * 60)
|
def remSec = curPercent < 0.05 ? '?' : (long) (((remTime / 60.0) - remMin) * 60)
|
||||||
|
|
||||||
lastInfo = info
|
lastInfo = info
|
||||||
if (info.length() > 16) info = info[0..<16]
|
if (info.length() > 16) info = info[0..<16]
|
||||||
|
Loading…
Reference in New Issue
Block a user