List of usage examples for io.vertx.core.cli CLI parse
CommandLine parse(List<String> arguments);
From source file:examples.cli.CLIExamples.java
License:Open Source License
public void example7(CLI cli, List<String> userCommandLineArguments) { CommandLine commandLine = cli.parse(userCommandLineArguments); }
From source file:examples.cli.CLIExamples.java
License:Open Source License
public void example8(CLI cli, List<String> userCommandLineArguments) { CommandLine commandLine = cli.parse(userCommandLineArguments); String opt = commandLine.getOptionValue("my-option"); boolean flag = commandLine.isFlagEnabled("my-flag"); String arg0 = commandLine.getArgumentValue(0); }
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 w ww . jav a 2 s .co m*/ stream.print(builder.toString()); } }
From source file:examples.cli.TypedCLIExamples.java
License:Open Source License
public void example2(CLI cli, List<String> userCommandLineArguments) { CommandLine commandLine = cli.parse(userCommandLineArguments); boolean flag = commandLine.getOptionValue("R"); File source = commandLine.getArgumentValue("source"); File target = commandLine.getArgumentValue("target"); }
From source file:examples.cli.TypedCLIExamples.java
License:Open Source License
public void example4(List<String> userCommandLineArguments) { CLI cli = CLI.create(AnnotatedCli.class); CommandLine commandLine = cli.parse(userCommandLineArguments); AnnotatedCli instance = new AnnotatedCli(); CLIConfigurator.inject(commandLine, instance); }