Skip to content

Commit

Permalink
Reduce verbosity during downloads in text-only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Nov 25, 2016
1 parent 8eae641 commit c363777
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@

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;
}
}

0 comments on commit c363777

Please sign in to comment.