11package org .dstadler .jgitfs ;
22
3+ import java .io .IOException ;
34import java .util .List ;
45import java .util .logging .Logger ;
56
6- import org .apache .commons .cli .*;
7+ import org .apache .commons .cli .CommandLine ;
8+ import org .apache .commons .cli .CommandLineParser ;
9+ import org .apache .commons .cli .DefaultParser ;
10+ import org .apache .commons .cli .Option ;
11+ import org .apache .commons .cli .Options ;
12+ import org .apache .commons .cli .help .HelpFormatter ;
713import org .apache .commons .lang3 .ArrayUtils ;
814import org .apache .commons .lang3 .exception .ExceptionUtils ;
915import org .dstadler .commons .logging .jdk .LoggerFactory ;
@@ -33,18 +39,18 @@ public Commandline() {
3339 Option .builder (OPTION_NO_CONSOLE ).
3440 longOpt ("no-console" ).
3541 desc ("Do not open the command-console" ).
36- build ());
42+ get ());
3743 cmdLineOptions .addOption (
3844 Option .builder (OPTION_TEST_ONLY ).
3945 longOpt ("test-only" ).
4046 desc ("Only try to mount and then exit again" ).
41- build ());
47+ get ());
4248 }
4349
44- public void parse (String [] args ) {
50+ public void parse (String [] args ) throws IOException {
4551 if (ArrayUtils .contains (args , "--help" ) || ArrayUtils .contains (args , "-h" )) {
46- HelpFormatter formatter = new HelpFormatter ();
47- formatter .printHelp (USAGE_TEXT , cmdLineOptions );
52+ HelpFormatter formatter = HelpFormatter . builder (). setShowSince ( false ). get ();
53+ formatter .printHelp (USAGE_TEXT , "" , cmdLineOptions , "" , true );
4854 throw new SystemExitException (null , 1 );
4955 }
5056
@@ -69,8 +75,8 @@ public void parse(String[] args) {
6975 "remaining: " + argList );
7076 } catch (Exception e ) {
7177 System .err .println ("Error parsing arguments: " + ExceptionUtils .getStackTrace (e ));
72- HelpFormatter formatter = new HelpFormatter ();
73- formatter .printHelp (USAGE_TEXT , cmdLineOptions );
78+ HelpFormatter formatter = HelpFormatter . builder (). setShowSince ( false ). get ();
79+ formatter .printHelp (USAGE_TEXT , "" , cmdLineOptions , "" , true );
7480 throw new SystemExitException (e , 1 );
7581 }
7682 }
0 commit comments