/** Run command - choose whether to exit on failure */ public void mainRun(boolean exitOnFailure) { mainRun(exitOnFailure, true) ; }
public void cmdError(String msg) { cmdError(msg, true) ;}
@Override final public void process() { super.process() ; forEach(new Action(){ @Override public void action(CmdArgModule controller, ArgModuleGeneral module) { module.processArgs(controller) ; } } ) ; processModulesAndArgs() ; }
try { mainMethod() ; } catch (TerminationException ex) { System.exit(ex.getCode()) ; } catch (IllegalArgumentException ex)
@Override final public void process() { super.process() ; forEach(new Action(){ @Override public void action(CmdArgModule controller, ArgModuleGeneral module) { module.processArgs(controller) ; } } ) ; processModulesAndArgs() ; }
try { mainMethod() ; } catch (TerminationException ex) { System.exit(ex.getCode()) ; } catch (IllegalArgumentException ex)
/** Run command - exit on failure */ public void mainRun() { mainRun(false, true) ; }
public void cmdError(String msg) { cmdError(msg, true) ;}
/** Run command - exit on success or failure */ public void mainAndExit() { mainRun(true, true) ; }
/** Run command - choose whether to exit on failure */ public void mainRun(boolean exitOnFailure) { mainRun(exitOnFailure, true) ; }
/** Run command - exit on failure */ public void mainRun() { mainRun(false, true) ; }
/** Run command - exit on success or failure */ public void mainAndExit() { mainRun(true, true) ; }
private static int exit(CmdMain cmd) { int code = cmd.mainRun(false, false) ; if ( code != 0 && exitOnError ) { System.err.println("Exit: command: "+Lib.className(cmd)) ; System.exit(code) ; } return code ; }