This is an automated email from the ASF dual-hosted git repository.
tilman pushed a commit to branch branch_3x
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/branch_3x by this push:
new 728a30f19 TIKA-4455: replace deprecated; add help option if not in xml
728a30f19 is described below
commit 728a30f1921c2c723f0faccbc306265ba88486ac
Author: Tilman Hausherr <[email protected]>
AuthorDate: Sat Aug 16 16:05:56 2025 +0200
TIKA-4455: replace deprecated; add help option if not in xml
---
.../main/java/org/apache/tika/batch/fs/FSBatchProcessCLI.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git
a/tika-batch/src/main/java/org/apache/tika/batch/fs/FSBatchProcessCLI.java
b/tika-batch/src/main/java/org/apache/tika/batch/fs/FSBatchProcessCLI.java
index 559bbae5f..9b3cffef3 100644
--- a/tika-batch/src/main/java/org/apache/tika/batch/fs/FSBatchProcessCLI.java
+++ b/tika-batch/src/main/java/org/apache/tika/batch/fs/FSBatchProcessCLI.java
@@ -29,9 +29,9 @@ import java.util.concurrent.Future;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
+import org.apache.commons.cli.help.HelpFormatter;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,6 +55,9 @@ public class FSBatchProcessCLI {
configIs = getConfigInputStream(args, true);
CommandLineParserBuilder builder = new CommandLineParserBuilder();
options = builder.build(configIs);
+ if (!options.hasOption("help")) {
+ options.addOption("?", "help", false, "this help message");
+ }
} finally {
IOUtils.closeQuietly(configIs);
}
@@ -71,9 +74,9 @@ public class FSBatchProcessCLI {
}
}
- public void usage() {
- HelpFormatter helpFormatter = new HelpFormatter();
- helpFormatter.printHelp("tika filesystem batch", options);
+ public void usage() throws IOException {
+ HelpFormatter helpFormatter = HelpFormatter.builder().get();
+ helpFormatter.printHelp("tika filesystem batch", null, options, null,
true);
}
private TikaInputStream getConfigInputStream(String[] args, boolean
logDefault) throws IOException {