From f33369f89747ed27d2f7e95de6b533fd39c63302 Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Tue, 10 Dec 2024 15:05:50 -0600 Subject: [PATCH 1/3] tiffcomment: fix `-version`, `-no-upgrade`, `-debug`, `-trace` --- .../src/loci/formats/tools/TiffComment.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java b/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java index 45d5aadcc6f..a22a5a48659 100644 --- a/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java +++ b/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java @@ -40,6 +40,7 @@ import loci.common.Constants; import loci.common.DataTools; +import loci.common.DebugTools; import loci.common.RandomAccessInputStream; import loci.common.RandomAccessOutputStream; import loci.formats.FormatException; @@ -73,8 +74,6 @@ public static void main(String[] args) throws FormatException, IOException { return; } - CommandLineTools.runUpgradeCheck(args); - // parse flags boolean edit = false; String newComment = null; @@ -106,9 +105,22 @@ else if (newComment.equals("-")) { } } } - else System.out.println("Warning: unknown flag: " + args[i]); + else if (args[i].equals(CommandLineTools.VERSION)) { + CommandLineTools.printVersion(); + } + else if (args[i].equals("-debug")) { + DebugTools.setRootLevel("DEBUG"); + } + else if (args[i].equals("-trace")) { + DebugTools.setRootLevel("TRACE"); + } + else if (!args[i].equals(CommandLineTools.NO_UPGRADE_CHECK)) { + System.out.println("Warning: unknown flag: " + args[i]); + } } + CommandLineTools.runUpgradeCheck(args); + // process files for (String file : files) { if (edit) { From 47661c26993043accc42730a12a5464c9ab827e7 Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Thu, 12 Dec 2024 09:22:07 -0600 Subject: [PATCH 2/3] Document additional tiffcomment options --- .../src/loci/formats/tools/TiffComment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java b/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java index a22a5a48659..1760de361c8 100644 --- a/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java +++ b/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java @@ -56,7 +56,7 @@ public static void main(String[] args) throws FormatException, IOException { if (args.length == 0) { System.out.println("Usage:"); System.out.println( - "tiffcomment [-set comment] [-edit] file1 [file2 ...]"); + "tiffcomment [-version] [-debug] [-trace] [-no-upgrade] [-set comment] [-edit] file1 [file2 ...]"); System.out.println(); System.out.println("This tool requires an ImageDescription tag to be " + @@ -71,6 +71,12 @@ public static void main(String[] args) throws FormatException, IOException { System.out.println(" * '-', to enter the comment using stdin. " + "Entering a blank line will"); System.out.println(" terminate reading from stdin."); + System.out.println(); + System.out.println("Additional options:"); + System.out.println(" -version: print the library version"); + System.out.println(" -no-upgrade: do not perform the upgrade check"); + System.out.println(" -debug: enable DEBUG-level logging"); + System.out.println(" -trace: enable TRACE-level logging"); return; } From b8d3ae1835477f63fb42ed7ef23318afaf5fcafb Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Thu, 12 Dec 2024 11:18:59 -0600 Subject: [PATCH 3/3] Exit after printing version --- .../bio-formats-tools/src/loci/formats/tools/TiffComment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java b/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java index 1760de361c8..506dac3ba1d 100644 --- a/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java +++ b/components/bio-formats-tools/src/loci/formats/tools/TiffComment.java @@ -73,7 +73,7 @@ public static void main(String[] args) throws FormatException, IOException { System.out.println(" terminate reading from stdin."); System.out.println(); System.out.println("Additional options:"); - System.out.println(" -version: print the library version"); + System.out.println(" -version: print the library version and exit"); System.out.println(" -no-upgrade: do not perform the upgrade check"); System.out.println(" -debug: enable DEBUG-level logging"); System.out.println(" -trace: enable TRACE-level logging"); @@ -113,6 +113,7 @@ else if (newComment.equals("-")) { } else if (args[i].equals(CommandLineTools.VERSION)) { CommandLineTools.printVersion(); + return; } else if (args[i].equals("-debug")) { DebugTools.setRootLevel("DEBUG");