Search in sources :

Example 1 with ShellCommand

use of org.springframework.boot.cli.command.shell.ShellCommand in project spring-boot by spring-projects.

the class SpringCli method main.

public static void main(String... args) {
    System.setProperty("java.awt.headless", Boolean.toString(true));
    LogbackInitializer.initialize();
    CommandRunner runner = new CommandRunner("spring");
    ClassUtils.overrideThreadContextClassLoader(createExtendedClassLoader(runner));
    runner.addCommand(new HelpCommand(runner));
    addServiceLoaderCommands(runner);
    runner.addCommand(new ShellCommand());
    runner.addCommand(new HintCommand(runner));
    runner.setOptionCommands(HelpCommand.class, VersionCommand.class);
    runner.setHiddenCommands(HintCommand.class);
    int exitCode = runner.runAndHandleErrors(args);
    if (exitCode != 0) {
        // If successful, leave it to run in case it's a server app
        System.exit(exitCode);
    }
}
Also used : HintCommand(org.springframework.boot.cli.command.core.HintCommand) HelpCommand(org.springframework.boot.cli.command.core.HelpCommand) ShellCommand(org.springframework.boot.cli.command.shell.ShellCommand) CommandRunner(org.springframework.boot.cli.command.CommandRunner)

Aggregations

CommandRunner (org.springframework.boot.cli.command.CommandRunner)1 HelpCommand (org.springframework.boot.cli.command.core.HelpCommand)1 HintCommand (org.springframework.boot.cli.command.core.HintCommand)1 ShellCommand (org.springframework.boot.cli.command.shell.ShellCommand)1