List of usage examples for io.vertx.core.cli CommandLine isAskingForHelp
boolean isAskingForHelp();
From source file:examples.cli.CLIExamples.java
License:Open Source License
public void example9(PrintStream stream) { CLI cli = CLI.create("test") .addOption(new Option().setLongName("help").setShortName("h").setFlag(true).setHelp(true)) .addOption(new Option().setLongName("mandatory").setRequired(true)); CommandLine line = cli.parse(Collections.singletonList("-h")); // The parsing does not fail and let you do: if (!line.isValid() && line.isAskingForHelp()) { StringBuilder builder = new StringBuilder(); cli.usage(builder);/*from www .ja v a 2 s . c o m*/ stream.print(builder.toString()); } }