本文整理匯總了Java中org.springframework.boot.cli.command.NoHelpCommandArgumentsException類的典型用法代碼示例。如果您正苦於以下問題:Java NoHelpCommandArgumentsException類的具體用法?Java NoHelpCommandArgumentsException怎麽用?Java NoHelpCommandArgumentsException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NoHelpCommandArgumentsException類屬於org.springframework.boot.cli.command包,在下文中一共展示了NoHelpCommandArgumentsException類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import org.springframework.boot.cli.command.NoHelpCommandArgumentsException; //導入依賴的package包/類
@Override
public ExitStatus run(String... args) throws Exception {
if (args.length == 0) {
throw new NoHelpCommandArgumentsException();
}
String commandName = args[0];
for (Command command : this.commandRunner) {
if (command.getName().equals(commandName)) {
Log.info(this.commandRunner.getName() + command.getName() + " - "
+ command.getDescription());
Log.info("");
if (command.getUsageHelp() != null) {
Log.info("usage: " + this.commandRunner.getName() + command.getName()
+ " " + command.getUsageHelp());
Log.info("");
}
if (command.getHelp() != null) {
Log.info(command.getHelp());
}
Collection<HelpExample> examples = command.getExamples();
if (examples != null) {
Log.info(examples.size() == 1 ? "example:" : "examples:");
Log.info("");
for (HelpExample example : examples) {
Log.info(" " + example.getDescription() + ":");
Log.info(" $ " + example.getExample());
Log.info("");
}
Log.info("");
}
return ExitStatus.OK;
}
}
throw new NoSuchCommandException(commandName);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:36,代碼來源:HelpCommand.java