@@ -32,21 +32,29 @@ public class BammCli extends AbstractCommand {
32
32
33
33
public static final String COMMAND_NAME = "bamm" ;
34
34
35
- private final CommandLine commandLine = new CommandLine ( this );
35
+ private final CommandLine commandLine = new CommandLine ( this )
36
+ .addSubcommand ( new AspectCommand () )
37
+ .setCaseInsensitiveEnumValuesAllowed ( true );
36
38
37
- public void run ( final String ... argv ) throws Exception {
38
- main ( argv );
39
+ int run ( final String ... argv ) {
40
+ return commandLine . execute ( argv );
39
41
}
40
42
41
- public static void main ( final String [] argv ) throws Exception {
43
+ int runWithExceptionHandler ( final CommandLine .IExecutionExceptionHandler exceptionHandler , final String ... argv ) {
44
+ final CommandLine .IExecutionExceptionHandler oldHandler = commandLine .getExecutionExceptionHandler ();
45
+ try {
46
+ commandLine .setExecutionExceptionHandler ( exceptionHandler );
47
+ return commandLine .execute ( argv );
48
+ } finally {
49
+ commandLine .setExecutionExceptionHandler ( oldHandler );
50
+ }
51
+ }
52
+
53
+ public static void main ( final String [] argv ) {
42
54
AnsiConsole .systemInstall ();
43
55
44
56
final BammCli command = new BammCli ();
45
- final CommandLine commandLine = command .commandLine
46
- .addSubcommand ( new AspectCommand () )
47
- .setCaseInsensitiveEnumValuesAllowed ( true );
48
-
49
- final int exitCode = commandLine .execute ( argv );
57
+ final int exitCode = command .commandLine .execute ( argv );
50
58
AnsiConsole .systemUninstall ();
51
59
System .exit ( exitCode );
52
60
}
0 commit comments