Skip to content

Commit 7ebaba3

Browse files
committed
Also allow for quiet skipping
1 parent e8e8509 commit 7ebaba3

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,9 +851,11 @@ Downloads a maven artifact from a Maven repository
851851
### mcopy
852852

853853
```
854-
Usage: mc-image-helper mcopy [-hz] [--file-is-listing] [--skip-existing]
855-
[--glob=GLOB] [--scope=<manifestId>] --to=<dest>
856-
SRC[,|<nl>SRC...]...
854+
Usage: mc-image-helper mcopy [-hz] [--file-is-listing]
855+
[--ignore-missing-sources] [--quiet-when-skipped]
856+
[--skip-existing] [--glob=GLOB]
857+
[--scope=<manifestId>] --to=<dest> SRC[,
858+
|<nl>SRC...]...
857859
Multi-source file copy operation with with managed cleanup. Supports
858860
auto-detected sourcing from file list, directories, and URLs
859861
SRC[,|<nl>SRC...]... Any mix of source file, directory, or URLs.
@@ -865,6 +867,10 @@ auto-detected sourcing from file list, directories, and URLs
865867
--glob=GLOB When a source is a directory, this filename glob
866868
will be applied to select files.
867869
-h, --help
870+
--ignore-missing-sources
871+
Don't log or fail exit code when any or all
872+
sources are missing
873+
--quiet-when-skipped Don't log when file exists or is up to date
868874
--scope, --manifest-id=<manifestId>
869875
If managed cleanup is required, this is the
870876
identifier used for qualifying manifest filename

src/main/java/me/itzg/helpers/sync/MulitCopyCommand.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import me.itzg.helpers.http.Uris;
2424
import org.jetbrains.annotations.Blocking;
2525
import org.reactivestreams.Publisher;
26+
import org.slf4j.event.Level;
2627
import picocli.CommandLine.Command;
2728
import picocli.CommandLine.ExitCode;
2829
import picocli.CommandLine.Option;
@@ -63,6 +64,9 @@ public class MulitCopyCommand implements Callable<Integer> {
6364
@Option(names = "--skip-existing", defaultValue = "false")
6465
boolean skipExisting;
6566

67+
@Option(names = "--quiet-when-skipped", description = "Don't log when file exists or is up to date")
68+
boolean quietWhenSkipped;
69+
6670
@Option(names = "--ignore-missing-sources", description = "Don't log or fail exit code when any or all sources are missing")
6771
boolean ignoreMissingSources;
6872

@@ -241,10 +245,12 @@ private Mono<Path> processRemoteSource(String source) {
241245
log.info("Downloading {} from {}", file, uri);
242246
break;
243247
case SKIP_FILE_UP_TO_DATE:
244-
log.info("The file {} is already up to date", file);
248+
log.atLevel(quietWhenSkipped ? Level.DEBUG : Level.INFO)
249+
.log("The file {} is already up to date", file);
245250
break;
246251
case SKIP_FILE_EXISTS:
247-
log.info("The file {} already exists", file);
252+
log.atLevel(quietWhenSkipped ? Level.DEBUG : Level.INFO)
253+
.log("The file {} already exists", file);
248254
break;
249255
case DOWNLOADED:
250256
break;

0 commit comments

Comments
 (0)