public Result cmd ( String cliCommand ) { try { // The intent here is to return a Response when this is doable. if ( ctx . isWorkflowMode ( ) || ctx . isBatchMode ( ) ) { ctx . handle ( cliCommand ) ; return new Result ( cliCommand , ctx . getExitCode ( ) ) ; } handler . parse ( ctx . getCurrentNodePath ( ) , cliCommand , ctx ) ; if ( handler . getFormat ( ) == OperationFormat . INSTANCE ) { ModelNode request = ctx . buildRequest ( cliCommand ) ; ModelNode response = ctx . execute ( request , cliCommand ) ; return new Result ( cliCommand , request , response ) ; } else { ctx . handle ( cliCommand ) ; return new Result ( cliCommand , ctx . getExitCode ( ) ) ; } } catch ( CommandLineException cfe ) { throw new IllegalArgumentException ( "Error handling command: " + cliCommand , cfe ) ; } catch ( IOException ioe ) { throw new IllegalStateException ( "Unable to send command " + cliCommand + " to server." , ioe ) ; } }
Execute a CLI command . This can be any command that you might execute on the CLI command line including both server - side operations and local commands such as cd or cn .