Skip to content
Snippets Groups Projects
Commit 0e1e729d authored by Wei Liu's avatar Wei Liu
Browse files

corrected --level arg

parent f2fb7835
Branches
Tags
No related merge requests found
......@@ -49,8 +49,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
private String token;
@Option(names = { "-l",
"--levels" }, paramLabel = "<n>", description = "Number of levels of sub-directories to search. Defaults to 1.", defaultValue = "1")
private int levels;
"--level" }, paramLabel = "<n>", description = "Level of sub-directories to search. Defaults to 1.", defaultValue = "1")
private int level;
@Option(names = { "-a",
"--after" }, paramLabel = "<dd-MMM-yyyy>", description = "Include only the data directories modified after this date (inclusive).", converter = DateTimeConverter.class)
......@@ -96,8 +96,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
if (!settings.hasShareableIdOrToken()) {
throw new IllegalArgumentException("No shareable id or token is specified!");
}
if (this.levels > 0) {
settings.setLevels(this.levels);
if (this.level > 0) {
settings.setLevel(this.level);
}
if (this.modifiedAfter != null) {
settings.setAfter(this.modifiedAfter);
......@@ -118,7 +118,7 @@ public class InstrumentUploadMissingFind implements MFCommand {
Set<LocalDirectory> missingDirectories = new LinkedHashSet<>();
Map<LocalDirectory, Upload> mismatchDirectories = new LinkedHashMap<>();
checkDirectories(settings.parentDirectories(), settings.levels(), settings.after(), settings.before(), uploads,
checkDirectories(settings.parentDirectories(), settings.level(), settings.after(), settings.before(), uploads,
missingDirectories, mismatchDirectories);
if (!missingDirectories.isEmpty()) {
......@@ -174,7 +174,7 @@ public class InstrumentUploadMissingFind implements MFCommand {
}
}
private void checkDirectories(Path parentDir, int levels, Date after, Date before, List<Upload> uploads,
private void checkDirectories(Path parentDir, int level, Date after, Date before, List<Upload> uploads,
Set<LocalDirectory> missingDirs, Map<LocalDirectory, Upload> mismatchDirs) throws IOException {
int rootDepth = parentDir.getNameCount();
......@@ -186,10 +186,10 @@ public class InstrumentUploadMissingFind implements MFCommand {
Objects.requireNonNull(dir);
Objects.requireNonNull(attrs);
int depth = dir.getNameCount();
if (depth > rootDepth + levels) {
if (depth > rootDepth + level) {
return FileVisitResult.SKIP_SUBTREE;
}
if (depth > rootDepth) {
if (depth == rootDepth + level) {
if (lastModifiedTimeMatches(attrs.lastModifiedTime(), after, before)) {
checkDirectory(dir, uploads, missingDirs, mismatchDirs);
}
......@@ -245,7 +245,7 @@ public class InstrumentUploadMissingFind implements MFCommand {
public static class Settings {
private Long _id;
private String _token;
private int _levels;
private int _level;
private Date _after;
private Date _before;
private boolean _compare = false;
......@@ -259,8 +259,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
return _token;
}
int levels() {
return _levels;
int level() {
return _level;
}
Date before() {
......@@ -289,8 +289,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
return this;
}
public Settings setLevels(int levels) {
_levels = levels;
public Settings setLevel(int level) {
_level = level;
return this;
}
......
......@@ -16,6 +16,6 @@ if exist "%JRE%\" (
set JAR=%ROOT%\lib\unimelb-mf-clients.jar
"%JAVA%" -XX:+UseG1GC -XX:+UseStringDeduplication -Xmx1g -cp "%JAR%" unimelb.mf.client.instrument.cli.InstrumentUploadList %*
"%JAVA%" -XX:+UseG1GC -XX:+UseStringDeduplication -Xmx1g -cp "%JAR%" unimelb.mf.client.instrument.cli.InstrumentUploadMissingFind %*
endlocal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment