From 0e1e729dd9024ffdfb34d82d0bf4e88c91509ee9 Mon Sep 17 00:00:00 2001 From: Wilson Liu <wliu5@unimelb.edu.au> Date: Mon, 14 Nov 2022 19:11:06 +1100 Subject: [PATCH] corrected --level arg --- .../cli/InstrumentUploadMissingFind.java | 26 +++++++++---------- .../instrument-upload-missing-find.cmd | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/unimelb/mf/client/instrument/cli/InstrumentUploadMissingFind.java b/src/main/java/unimelb/mf/client/instrument/cli/InstrumentUploadMissingFind.java index 9417ab9..033cc3a 100644 --- a/src/main/java/unimelb/mf/client/instrument/cli/InstrumentUploadMissingFind.java +++ b/src/main/java/unimelb/mf/client/instrument/cli/InstrumentUploadMissingFind.java @@ -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; } diff --git a/src/main/scripts/windows/instrument-upload-missing-find.cmd b/src/main/scripts/windows/instrument-upload-missing-find.cmd index 76db99b..945cf7c 100644 --- a/src/main/scripts/windows/instrument-upload-missing-find.cmd +++ b/src/main/scripts/windows/instrument-upload-missing-find.cmd @@ -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 -- GitLab