@ -24,10 +24,10 @@ import java.util.EnumSet;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.List ;
import java.util.List ;
import java.util.Map ;
import java.util.Map ;
import java.util.ServiceLoader ;
import java.util.Set ;
import java.util.Set ;
import org.springframework.boot.cli.command.AbstractCommand ;
import org.springframework.boot.cli.command.AbstractCommand ;
import org.springframework.boot.cli.command.InitCommand ;
/ * *
/ * *
* Spring Command Line Interface . This is the main entry - point for the Spring command line
* Spring Command Line Interface . This is the main entry - point for the Spring command line
@ -54,28 +54,20 @@ public class SpringCli {
private String displayName = CLI_APP + " " ;
private String displayName = CLI_APP + " " ;
private InitCommand init ;
private Map < String , Command > commandMap = new HashMap < String , Command > ( ) ;
private Map < String , Command > commandMap = new HashMap < String , Command > ( ) ;
/ * *
/ * *
* Create a new { @link SpringCli } implementation with the default set of commands .
* Create a new { @link SpringCli } implementation with the default set of commands .
* /
* /
public SpringCli ( String . . . args ) {
public SpringCli ( String . . . args ) {
try {
for ( CommandFac to ry factory : ServiceLoader . load ( CommandFactory . class ) ) {
this. init = new InitCommand ( this ) ;
for ( Command command : factory . getCommands ( this ) ) {
this . init . run ( args ) ;
register ( command ) ;
}
}
catch ( Exception e ) {
throw new IllegalStateException ( "Cannot init with those args" , e ) ;
}
}
addBaseCommands ( ) ;
addBaseCommands ( ) ;
}
}
public InitCommand getInitCommand ( ) {
return this . init ;
}
/ * *
/ * *
* Set the command available to the CLI . Primarily used to support testing . NOTE : The
* Set the command available to the CLI . Primarily used to support testing . NOTE : The
* ' help ' command will be automatically provided in addition to this list .
* ' help ' command will be automatically provided in addition to this list .