Java 类org.springframework.boot.cli.command.core.HintCommand 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringCli.java   
public static void main(String... args) {
    System.setProperty("java.awt.headless", Boolean.toString(true));
    LogbackInitializer.initialize();

    CommandRunner runner = new CommandRunner("spring");
    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);
    }
}
项目:spring-boot-concourse    文件:SpringCli.java   
public static void main(String... args) {
    System.setProperty("java.awt.headless", Boolean.toString(true));
    LogbackInitializer.initialize();

    CommandRunner runner = new CommandRunner("spring");
    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);
    }
}
项目:contestparser    文件:SpringCli.java   
public static void main(String... args) {
    System.setProperty("java.awt.headless", Boolean.toString(true));
    LogbackInitializer.initialize();

    CommandRunner runner = new CommandRunner("spring");
    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);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CommandRunnerTests.java   
@Before
public void setup() {
    this.loader = Thread.currentThread().getContextClassLoader();
    MockitoAnnotations.initMocks(this);
    this.commandRunner = new CommandRunner("spring") {

        @Override
        protected void showUsage() {
            CommandRunnerTests.this.calls.add(Call.SHOW_USAGE);
            super.showUsage();
        };

        @Override
        protected boolean errorMessage(String message) {
            CommandRunnerTests.this.calls.add(Call.ERROR_MESSAGE);
            return super.errorMessage(message);
        }

        @Override
        protected void printStackTrace(Exception ex) {
            CommandRunnerTests.this.calls.add(Call.PRINT_STACK_TRACE);
            super.printStackTrace(ex);
        }
    };
    given(this.anotherCommand.getName()).willReturn("another");
    given(this.regularCommand.getName()).willReturn("command");
    given(this.regularCommand.getDescription()).willReturn("A regular command");
    this.commandRunner.addCommand(this.regularCommand);
    this.commandRunner.addCommand(new HelpCommand(this.commandRunner));
    this.commandRunner.addCommand(new HintCommand(this.commandRunner));
}
项目:spring-boot-concourse    文件:CommandRunnerTests.java   
@Before
public void setup() {
    this.loader = Thread.currentThread().getContextClassLoader();
    MockitoAnnotations.initMocks(this);
    this.commandRunner = new CommandRunner("spring") {

        @Override
        protected void showUsage() {
            CommandRunnerTests.this.calls.add(Call.SHOW_USAGE);
            super.showUsage();
        };

        @Override
        protected boolean errorMessage(String message) {
            CommandRunnerTests.this.calls.add(Call.ERROR_MESSAGE);
            return super.errorMessage(message);
        }

        @Override
        protected void printStackTrace(Exception ex) {
            CommandRunnerTests.this.calls.add(Call.PRINT_STACK_TRACE);
            super.printStackTrace(ex);
        }
    };
    given(this.anotherCommand.getName()).willReturn("another");
    given(this.regularCommand.getName()).willReturn("command");
    given(this.regularCommand.getDescription()).willReturn("A regular command");
    this.commandRunner.addCommand(this.regularCommand);
    this.commandRunner.addCommand(new HelpCommand(this.commandRunner));
    this.commandRunner.addCommand(new HintCommand(this.commandRunner));
}
项目:contestparser    文件:CommandRunnerTests.java   
@Before
public void setup() {
    this.loader = Thread.currentThread().getContextClassLoader();
    MockitoAnnotations.initMocks(this);
    this.commandRunner = new CommandRunner("spring") {

        @Override
        protected void showUsage() {
            CommandRunnerTests.this.calls.add(Call.SHOW_USAGE);
            super.showUsage();
        };

        @Override
        protected boolean errorMessage(String message) {
            CommandRunnerTests.this.calls.add(Call.ERROR_MESSAGE);
            return super.errorMessage(message);
        }

        @Override
        protected void printStackTrace(Exception ex) {
            CommandRunnerTests.this.calls.add(Call.PRINT_STACK_TRACE);
            super.printStackTrace(ex);
        }
    };
    given(this.anotherCommand.getName()).willReturn("another");
    given(this.regularCommand.getName()).willReturn("command");
    given(this.regularCommand.getDescription()).willReturn("A regular command");
    this.commandRunner.addCommand(this.regularCommand);
    this.commandRunner.addCommand(new HelpCommand(this.commandRunner));
    this.commandRunner.addCommand(new HintCommand(this.commandRunner));
}