Compare commits

..

8 Commits

5 changed files with 41 additions and 23 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
target/
deploy/
*.class *.class

View File

@@ -1,4 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -uo pipefail set -uo pipefail
javac -Xlint -d target/ src/**/*.java if [[ $# -ge 1 && $1 == "clean" ]]; then
rm -r target/;
fi
javac -Xlint -d target/ src/**/*.java;

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -uo pipefail
if [[ -d deploy/ ]]; then
rm -r deploy/;
fi
cp -r target/ deploy/;

View File

@@ -74,7 +74,7 @@ public abstract class AbstractLoadingBar {
} }
public long getPassedMinutes() { public final long getPassedMinutes() {
return getPassedMinutes(false); return getPassedMinutes(false);
} }
@@ -84,37 +84,37 @@ public abstract class AbstractLoadingBar {
} }
public void showLoadingBar() { public final void showLoadingBar() {
showLoadingBar(false, false, 0); realShowLoadingBar(false, false, 0);
} }
public void showLoadingBar(boolean debug, boolean passedMinutesZero) { public final void showLoadingBar(boolean debug, boolean passedMinutesZero) {
showLoadingBar(debug, passedMinutesZero, 100L); realShowLoadingBar(debug, passedMinutesZero, 100L);
} }
public void showLoadingBarDebug() { public final void showLoadingBarDebug() {
showLoadingBar(true, true, 100L); realShowLoadingBar(true, true, 100L);
} }
public void showLoadingBarDebug(long millisWaiting) { public final void showLoadingBarDebug(long millisWaiting) {
showLoadingBar(true, true, millisWaiting); realShowLoadingBar(true, true, millisWaiting);
} }
public void showLoadingBarDebug(boolean passedMinutesZero) { public final void showLoadingBarDebug(boolean passedMinutesZero) {
showLoadingBar(true, passedMinutesZero, 100L); realShowLoadingBar(true, passedMinutesZero, 100L);
} }
public void showLoadingBarDebug(boolean passedMinutesZero, long millisWaiting) { public final void showLoadingBarDebug(boolean passedMinutesZero, long millisWaiting) {
showLoadingBar(true, passedMinutesZero, millisWaiting); realShowLoadingBar(true, passedMinutesZero, millisWaiting);
} }
private void showLoadingBar(boolean debug, boolean passedMinutesZero, long millisWaiting) { private void realShowLoadingBar(boolean debug, boolean passedMinutesZero, long millisWaiting) {
long passedMinutes = getPassedMinutes(debug && passedMinutesZero); long passedMinutes = getPassedMinutes(debug && passedMinutesZero);
if (passedMinutes > totalMinutes) { if (passedMinutes > totalMinutes) {
passedMinutes = totalMinutes; passedMinutes = totalMinutes;
@@ -129,23 +129,27 @@ public abstract class AbstractLoadingBar {
passedMinutes++; passedMinutes++;
} }
println(fillLoadingBar(passedMinutes, false)); println(fillLoadingBar(passedMinutes, false));
afterShowLoadingBar();
} }
protected abstract String fillLoadingBar(long passedMinutes, boolean progressive); protected abstract String fillLoadingBar(long passedMinutes, boolean progressive);
protected void waitUntilNextMinute() { protected void afterShowLoadingBar() {}
protected final void waitUntilNextMinute() {
waitUntilNextMinute(false, 0L); waitUntilNextMinute(false, 0L);
} }
protected void waitUntilNextMinuteDebug() { protected final void waitUntilNextMinuteDebug() {
waitUntilNextMinute(true, 100L); waitUntilNextMinute(true, 100L);
} }
protected void waitUntilNextMinuteDebug(long millisWaiting) { protected final void waitUntilNextMinuteDebug(long millisWaiting) {
waitUntilNextMinute(true, millisWaiting); waitUntilNextMinute(true, millisWaiting);
} }

View File

@@ -45,14 +45,16 @@ public class SimpleLoadingBar extends AbstractProgressBar {
} else { } else {
startTime = firstTime; startTime = firstTime;
} }
boolean debug = false;
boolean passedMinutesZero = false;
if (args.length == 2 || !title.isBlank()) { if (args.length == 2 || !title.isBlank()) {
new SimpleLoadingBar(startTime, endTime, title).showLoadingBar(); new SimpleLoadingBar(startTime, endTime, title).showLoadingBar(debug, passedMinutesZero);
return; return;
} }
// if there are 3 arguments, the third will be discarded. // if there are 3 arguments, the third will be discarded.
boolean hasTitleArg = args.length > 3 && "-msg".equals(args[2]); boolean hasTitleArg = args.length > 3 && "-msg".equals(args[2]);
title = hasTitleArg ? args[3] : title; title = hasTitleArg ? args[3] : title;
new SimpleLoadingBar(startTime, endTime, title).showLoadingBar(); new SimpleLoadingBar(startTime, endTime, title).showLoadingBar(debug, passedMinutesZero);
} }
@@ -94,9 +96,7 @@ public class SimpleLoadingBar extends AbstractProgressBar {
@Override @Override
public void showLoadingBar() { protected void afterShowLoadingBar() {
super.showLoadingBar();
// showLoadingBarDebug(); // DEBUG
println(title); println(title);
} }
} }