Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiffcomment: fix -version, -no-upgrade, -debug, -trace #4258

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
sbesson marked this conversation as resolved.
Show resolved Hide resolved
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
Loading