List of usage examples for org.apache.commons.cli Option Option
public Option(String opt, String longOpt, boolean hasArg, String description) throws IllegalArgumentException
From source file:com.github.riccardove.easyjasub.commandline.CommandLineOptionList.java
public void addOption(String opt, String longOpt, String description) { Option option = new Option(opt, longOpt, false, description); add(opt, option);//from w w w . ja v a2s . co m }
From source file:com.vectorization.client.Application.java
private static Options createOptions() { Options options = new Options(); options.addOption("D", "database", true, "Database to use."); options.addOption("h", "host", true, "Connect to host."); OptionBuilder.withLongOpt("help"); OptionBuilder.withDescription("Print this message"); Option help = OptionBuilder.create(); options.addOption(help);// w w w . j a v a 2 s .c o m Option passwordOption = new Option("p", "password", true, "Password to use when connecting " + "to server. If password is not " + "given it's asked from the tty."); passwordOption.setOptionalArg(true); options.addOption(passwordOption); options.addOption("P", "port", true, "Port number to use for connection"); options.addOption("u", "user", true, "User for login if not current user."); options.addOption("V", "version", false, "Output version information and exit."); return options; }
From source file:com.netscape.cmstools.client.ClientCertModifyCLI.java
public void createOptions() { Option option = new Option(null, "trust", true, "Trust attributes. Default: u,u,u."); option.setArgName("trust attributes"); options.addOption(option);/*from w w w . ja va2 s. co m*/ }
From source file:com.alibaba.rocketmq.tools.command.namesrv.WipeWritePermSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("b", "brokerName", true, "broker name"); opt.setRequired(true);/*from w w w .j a v a 2 s .c om*/ options.addOption(opt); return options; }
From source file:com.netscape.cmstools.key.KeyShowCLI.java
public void createOptions() { Option option = new Option(null, "clientKeyID", true, "Unique client key identifier."); option.setArgName("Client Key Identifier"); options.addOption(option);/*from w ww.j a v a2 s.c o m*/ }
From source file:com.twitter.hraven.etl.ProcessingRecordsPrinter.java
/** * Parse command-line arguments./* ww w.ja v a 2 s .c o m*/ * * @param args * command line arguments passed to program. * @return parsed command line. * @throws ParseException */ private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); // Input Option o = new Option("m", "maxCount", true, "maximum number of records to be returned"); o.setArgName("maxCount"); o.setRequired(false); options.addOption(o); o = new Option("c", "cluster", true, "cluster for which jobs are processed"); o.setArgName("cluster"); o.setRequired(true); options.addOption(o); o = new Option("p", "processFileSubstring", true, "use only those process records where the process file path contains the provided string."); o.setArgName("processFileSubstring"); o.setRequired(false); options.addOption(o); // Debugging options.addOption("d", "debug", false, "switch on DEBUG log level"); CommandLineParser parser = new PosixParser(); CommandLine commandLine = null; try { commandLine = parser.parse(options, args); } catch (Exception e) { System.err.println("ERROR: " + e.getMessage() + "\n"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(NAME + " ", options, true); System.exit(-1); } // Set debug level right away if (commandLine.hasOption("d")) { Logger log = Logger.getLogger(ProcessingRecordsPrinter.class); log.setLevel(Level.DEBUG); } return commandLine; }
From source file:com.alibaba.rocketmq.tools.command.namesrv.UpdateProjectGroupCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("i", "ip", true, "set the server ip"); opt.setRequired(true);/* www. j ava2s. c o m*/ options.addOption(opt); opt = new Option("p", "project", true, "set the project group"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.opengamma.integration.tool.marketdata.MarketDataSnapshotToolUtils.java
public static Option createSnapshotVersionListOption() { final Option option = new Option(SNAPSHOT_VERSION_LIST_OPTION, "snapshot-versions", true, "List the versions available for a named snapshot"); option.setArgName("snapshot name"); return option; }
From source file:com.github.horrorho.inflatabledonkey.args.OptionsFactory.java
public static Map<Option, Property> options() { LinkedHashMap<Option, Property> options = new LinkedHashMap<>(); options.put(Option.builder("d").longOpt("device").desc("Device, default: 0 = first device.").argName("int") .hasArg().build(), Property.SELECT_DEVICE_INDEX); options.put(Option.builder("s").longOpt("snapshot").desc("Snapshot, default: 0 = first snapshot.") .argName("int").hasArg().build(), Property.SELECT_SNAPSHOT_INDEX); options.put(Option.builder().longOpt("extension").desc("File extension filter, case insensitive.") .argName("string").hasArg().build(), Property.FILTER_EXTENSION); options.put(Option.builder().longOpt("domain").desc("Domain filter, case insensitive.").argName("string") .hasArg().build(), Property.FILTER_DOMAIN); options.put(Option.builder("o").longOpt("folder").desc("Output folder.").argName("string").hasArg().build(), Property.OUTPUT_FOLDER);//w ww . j a va 2 s . co m options.put(new Option(null, "snapshots", false, "List device/ snapshot information and exit."), Property.PRINT_SNAPSHOTS); options.put( new Option(null, "domains", false, "List domains/ file count for the selected snapshot and exit."), Property.PRINT_DOMAIN_LIST); options.put(new Option(null, "token", false, "Display dsPrsID:mmeAuthToken and exit."), Property.ARGS_TOKEN); options.put(new Option(null, "help", false, "Display this help and exit."), Property.ARGS_HELP); return options; }
From source file:com.alibaba.rocketmq.tools.command.broker.BrokerStatsSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("b", "brokerAddr", true, "Broker address"); opt.setRequired(true);/* www .ja va2s . c o m*/ options.addOption(opt); return options; }