Fix filter-date format & add test for filter-date

This commit is contained in:
RatzzFatzz
2026-01-13 15:50:38 +01:00
parent 41e107ef85
commit 906ec944eb
3 changed files with 25 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ public class FileFilter {
if (!hasMatchingPattern(pathName)
|| isExcluded(pathName, new HashSet<>(excluded))
|| lastExecutionHandler != null && !isNewOrChanged(pathName)
|| lastExecutionHandler != null && !isNewer(pathName, lastExecutionHandler.get(pathName.getAbsolutePath()))
|| !isNewer(pathName, filterDate)) {
log.debug("Excluded {}", pathName);
ResultStatistic.getInstance().excluded();
@@ -83,9 +83,4 @@ public class FileFilter {
return false;
}
private boolean isNewOrChanged(File pathname) {
Instant lastExecutionDate = lastExecutionHandler.get(pathname.getAbsolutePath());
return lastExecutionDate == null || isNewer(pathname, lastExecutionDate);
}
}

View File

@@ -56,7 +56,7 @@ public class InputConfig implements CommandLine.IVersionProvider {
// TODO: implement usage
@Option(names = {"-n", "--only-new-files"}, description = "ignores all files unchanged and previously processed")
private boolean onlyNewFiles;
@Option(names = {"-d", "--filter-date"}, defaultValue = Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")")
@Option(names = {"-d", "--filter-date"}, defaultValue = Option.NULL_VALUE, description = "only consider files created newer than entered date (following ISO-8601 yyyy-MM-ddTHH:mm:ss.sssZ)")
private Instant filterDate;
@Option(names = {"-i", "--include-pattern"}, defaultValue = ".*", description = "include files matching pattern")
private Pattern includePattern;