Skip to content

Commit

Permalink
Merge pull request #4258 from melissalinkert/tiffcomment-options
Browse files Browse the repository at this point in the history
tiffcomment: fix `-version`, `-no-upgrade`, `-debug`, `-trace`
  • Loading branch information
sbesson authored Dec 13, 2024
2 parents 2f26848 + b8d3ae1 commit 342b084
Showing 1 changed file with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -55,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 " +
Expand All @@ -70,11 +71,15 @@ 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 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");
return;
}

CommandLineTools.runUpgradeCheck(args);

// parse flags
boolean edit = false;
String newComment = null;
Expand Down Expand Up @@ -106,9 +111,23 @@ else if (newComment.equals("-")) {
}
}
}
else System.out.println("Warning: unknown flag: " + args[i]);
else if (args[i].equals(CommandLineTools.VERSION)) {
CommandLineTools.printVersion();
return;
}
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) {
Expand Down

0 comments on commit 342b084

Please sign in to comment.