2929import org .apache .commons .cli .CommandLine ;
3030import org .apache .commons .cli .CommandLineParser ;
3131import org .apache .commons .cli .DefaultParser ;
32- import org .apache .commons .cli .HelpFormatter ;
3332import org .apache .commons .cli .Option ;
3433import org .apache .commons .cli .Options ;
34+ import org .apache .commons .cli .help .HelpFormatter ;
3535import org .apache .commons .io .IOUtils ;
3636import org .slf4j .Logger ;
3737import org .slf4j .LoggerFactory ;
@@ -55,6 +55,9 @@ public FSBatchProcessCLI(String[] args) throws IOException {
5555 configIs = getConfigInputStream (args , true );
5656 CommandLineParserBuilder builder = new CommandLineParserBuilder ();
5757 options = builder .build (configIs );
58+ if (!options .hasOption ("help" )) {
59+ options .addOption ("?" , "help" , false , "this help message" );
60+ }
5861 } finally {
5962 IOUtils .closeQuietly (configIs );
6063 }
@@ -71,9 +74,9 @@ public static void main(String[] args) throws Exception {
7174 }
7275 }
7376
74- public void usage () {
75- HelpFormatter helpFormatter = new HelpFormatter ();
76- helpFormatter .printHelp ("tika filesystem batch" , options );
77+ public void usage () throws IOException {
78+ HelpFormatter helpFormatter = HelpFormatter . builder (). get ();
79+ helpFormatter .printHelp ("tika filesystem batch" , null , options , null , true );
7780 }
7881
7982 private TikaInputStream getConfigInputStream (String [] args , boolean logDefault ) throws IOException {
0 commit comments