1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Reduce verbosity during downloads in text-only mode

This commit is contained in:
Cristian Maglie 2016-11-07 18:38:29 +01:00
parent 8eae64181e
commit c363777f06

View File

@ -33,12 +33,19 @@ import cc.arduino.utils.Progress;
public class ConsoleProgressListener implements ProgressListener {
private String lastStatus = "";
private double lastProgress = 0.0;
@Override
public void onProgress(Progress progress) {
if (!lastStatus.equals(progress.getStatus())) {
// Reduce verbosity when running in console
String s = progress.getStatus().replaceAll("[0-9]", "");
double p = progress.getProgress();
if (!lastStatus.equals(s) || (p - lastProgress) > 1.0) {
System.out.println(progress.getStatus());
lastProgress = p;
}
lastStatus = progress.getStatus();
lastStatus = s;
}
}