List of usage examples for io.vertx.core.cli CommandLine getOptionValue
@Nullable <T> T getOptionValue(String name);
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.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.ShellExamples.java
License:Open Source License
public void cliCommand() { CLI cli = CLI.create("my-command").addArgument(new Argument().setArgName("my-arg")) .addOption(new Option().setShortName("m").setLongName("my-option")); CommandBuilder command = CommandBuilder.command(cli); command.processHandler(process -> { CommandLine commandLine = process.commandLine(); String argValue = commandLine.getArgumentValue(0); String optValue = commandLine.getOptionValue("my-option"); process.write("The argument is " + argValue + " and the option is " + optValue); process.end();//from w ww . ja v a2s . c o m }); }