public void run ( ) throws RuntimeException { if ( terminalArgs == null ) { terminalArgs = new String [ 0 ] ; } p = GNUishParser . parse ( terminalArgs ) ; readCommands ( ) ; if ( p . getCommand ( ) == null || "" . equals ( p . getCommand ( ) ) ) { Utils . printAvailableCommandsHelp ( commands ) ; return ; } final Command cmd = commands . get ( p . getCommand ( ) ) ; if ( cmd == null ) { throw CliException . COMMAND_NOT_FOUND ( p . getCommand ( ) ) ; } if ( p . help ( ) ) { Utils . printCommandHelp ( cmd ) ; return ; } try { cmd . execute ( p ) ; } catch ( Exception e ) { if ( p . debug ( ) ) { e . printStackTrace ( ) ; } if ( e instanceof RuntimeException ) { throw ( RuntimeException ) e ; } } }
Start evaluating the user input and eventually execute the command requested by the user .