List of usage examples for org.apache.commons.cli Option Option
public Option(String opt, String description) throws IllegalArgumentException
From source file:com.rabbitmq.client.test.performance.CLIHelper.java
public static CLIHelper defaultHelper() { Options opts = new Options(); opts.addOption(new Option("help", "print this message")); opts.addOption(new Option("h", "host", true, "broker host")); opts.addOption(new Option("p", "port", true, "broker port")); return new CLIHelper(opts); }
From source file:com.google.play.developerapi.samples.ApplicationConfig.java
public static ApplicationConfig parseArgs(String[] args) { Options options = new Options(); try {/*from w ww.j a v a 2 s . c om*/ CommandLineParser parser = new GnuParser(); Option appId = new Option("appId", "Application id (package name)"); appId.setArgs(1); appId.setRequired(true); options.addOption(appId); Option secrets = new Option("secrets", "Client secrets path"); secrets.setArgs(1); secrets.setRequired(true); options.addOption(secrets); Option account = new Option("account", "Service account email"); account.setArgs(1); account.setRequired(false); options.addOption(account); Option appName = new Option("appName", "Application name"); appName.setArgs(1); appName.setRequired(false); options.addOption(appName); Option apkFilePath = new Option("apkFilePath", "Apk file path"); apkFilePath.setArgs(1); apkFilePath.setRequired(false); options.addOption(apkFilePath); return new ApplicationConfig(parser.parse(options, args)); } catch (ParseException ex) { System.err.println(ex.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("android-publisher-api", options); return null; } }
From source file:is.merkor.cli.MerkorCommandLineOptions.java
private static void createBooleanOptions() { help = new Option("help", "print this message"); help_h = new Option("h", "print this message"); bin_mapping = new Option("bin_mapping", "call IceTagsBinMapping"); fill_db = new Option("fill_db", "populate database from file"); extract_patterns = new Option("extract_patterns", "extract np / pp patterns from file"); merge_patterns = new Option("merge_patterns", "merge patterns having same relation in the database"); relations2dbstatements = new Option("relations2dbstatements", "create an .sql file with insert statements for files in relationDetectorResults/"); }
From source file:com.denimgroup.threadfix.cli.CommandLineParser.java
@SuppressWarnings("static-access") public static final Options getOptions() { Options options = new Options(); Option teams = OptionBuilder.withLongOpt("teams") .withDescription("Fetches a list of ThreadFix teams and applications.").create("t"); options.addOption(teams);//from w ww. ja v a 2s . co m options.addOption(new Option("help", "Print this message")); Option set = OptionBuilder.withArgName("property> <value").withValueSeparator(' ').hasArgs(2) .withLongOpt("set") .withDescription("Set either the url (ThreadFix base url) or key (ThreadFix API key) properties") .create("s"); options.addOption(set); Option createTeam = OptionBuilder.withArgName("name").hasArg().withLongOpt("create-team") .withDescription("Creates a ThreadFix team and returns its JSON.").create("ct"); options.addOption(createTeam); Option createApp = OptionBuilder.withArgName("teamId> <name> <url").withValueSeparator(' ').hasArgs(3) .withLongOpt("create-app").withDescription("Creates a ThreadFix application and returns its JSON.") .create("ca"); options.addOption(createApp); Option createWaf = OptionBuilder.withArgName("name> <wafTypeName").withValueSeparator(' ').hasArgs(2) .withLongOpt("create-waf").withDescription("Creates a ThreadFix WAF and returns its JSON.") .create("cw"); options.addOption(createWaf); Option searchTeam = OptionBuilder.withArgName("property> <value").withValueSeparator(' ').hasArgs(2) .withLongOpt("search-team").withDescription("Searches for a ThreadFix team and returns its JSON.") .create("st"); options.addOption(searchTeam); Option searchWaf = OptionBuilder.withArgName("property> <value").withValueSeparator(' ').hasArgs(2) .withLongOpt("search-waf").withDescription("Searches for a ThreadFix WAF and returns its JSON.") .create("sw"); options.addOption(searchWaf); Option searchApp = OptionBuilder.withArgName("property> <value1> <value2").withValueSeparator(' ') .hasArgs(3).withLongOpt("search-app") .withDescription("Searches for a ThreadFix application and returns its JSON.").create("sa"); options.addOption(searchApp); Option upload = OptionBuilder.withArgName("appId> <file").withValueSeparator(' ').hasArgs(2) .withLongOpt("upload").withDescription("Uploads a scan to the specified application.").create("u"); options.addOption(upload); Option getRules = OptionBuilder.withArgName("wafId").hasArg().withLongOpt("rules") .withDescription("Gets WAF Rules and returns its JSON.").create("r"); options.addOption(getRules); return options; }
From source file:com.consol.citrus.CitrusCliOptions.java
/** * Default constructor./*from w ww.j a v a 2s. c o m*/ */ @SuppressWarnings("static-access") public CitrusCliOptions() { this.addOption(new Option("help", "print usage help")); this.addOption(OptionBuilder.withArgName("suitename").hasArg() .withDescription("list of testsuites (seperated by blanks) that should run").isRequired(false) .create("suitename")); this.addOption(OptionBuilder.withArgName("test").hasArgs() .withDescription("list of test (seperated by blanks) that should run").isRequired(false) .create("test")); this.addOption(OptionBuilder.withArgName("testdir").hasArg() .withDescription("directory to look for test files").isRequired(false).create("testdir")); this.addOption(OptionBuilder.withArgName("package").hasArgs() .withDescription("executes all tests in a package").isRequired(false).create("package")); }
From source file:is.merkor.statistics.cli.MerkorCommandLineOptions.java
private static void createBooleanOptions() { help = new Option("help", "print this message"); help_h = new Option("h", "print this message"); tensor = new Option("tensor", "create tensor from relations db"); }
From source file:is.merkor.core.cli.MerkorCoreCommandLineOptions.java
private static void createBooleanOptions() { help = new Option("help", "print this message"); help_h = new Option("h", "print this message"); clusters = new Option("clusters", "get all cluster names"); }
From source file:it.infodreams.syncpath.commands.Commander.java
public Commander() { Option help = new Option("help", "Print this help message"); Option verbose = new Option("verbose", "Show more output information during process"); Option version = new Option("version", "Show the version information"); Option scan = OptionBuilder.withLongOpt("scan") .withDescription("Attempts full scan of a specified path and creates a report").create("c"); Option pack = OptionBuilder.withLongOpt("pack").withDescription("Perform a packing process").create("p"); Option unpack = OptionBuilder.withLongOpt("unpack").withDescription("Perform a packing process") .create("u"); Option sourcePath = OptionBuilder.withArgName("path").hasArg() .withDescription("Path to use as source for operations.").withLongOpt("source-path").create("s"); Option destPath = OptionBuilder.withArgName("path").hasArg() .withDescription("Path to use as destionation for operations.").withLongOpt("dest-path") .create("d"); Option reportFile = OptionBuilder.withArgName("filename").hasArg() .withDescription("Report to use as source for packing operations.").withLongOpt("report") .create("r"); Option splitSize = OptionBuilder.withArgName("size-in-bytes").hasArg() .withDescription("Size of each splitted package (0 for unlimited size).").withLongOpt("split-size") .create("t"); options.addOption(help);/* w w w . j av a 2s . com*/ options.addOption(verbose); options.addOption(version); options.addOption(scan); options.addOption(sourcePath); options.addOption(destPath); options.addOption(reportFile); options.addOption(pack); options.addOption(splitSize); options.addOption(unpack); }
From source file:edu.umass.cs.gnsserver.localnameserver.LocalNameServerOptions.java
/** * Returns all the command line options. * * @return the command line options// www . jav a 2s.co m */ public static Options getAllOptions() { Option help = new Option("help", "Prints usage"); Option configFile = new Option(CONFIG_FILE, true, "Configuration file with list of parameters and values (an alternative to using command-line options)"); Option nsFile = new Option(NS_FILE, true, "File with node configuration of all name servers"); Option port = new Option(PORT, true, "Port"); // Option fileLoggingLevel = new Option(FILE_LOGGING_LEVEL, true, "Verbosity level of log file. Should be one of SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST."); // Option consoleOutputLevel = new Option(CONSOLE_OUTPUT_LEVEL, true, "Verbosity level of console output. Should be one of SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST."); Option debug = new Option(DEBUG, "Enables debugging output"); Option debugPing = new Option(DEBUG_PING, "Enables debugging output for PingManager"); Option debugMisc = new Option(DEBUG_MISC, "Enables debugging output for miscellaneous subsystems"); Option disableSSL = new Option(DISABLE_SSL, "disables SSL authentication of LNS to server commands"); Options commandLineOptions = new Options(); commandLineOptions.addOption(configFile); commandLineOptions.addOption(help); commandLineOptions.addOption(nsFile); commandLineOptions.addOption(port); commandLineOptions.addOption(debug); commandLineOptions.addOption(debugPing); commandLineOptions.addOption(debugMisc); // commandLineOptions.addOption(fileLoggingLevel); // commandLineOptions.addOption(consoleOutputLevel); commandLineOptions.addOption(disableSSL); return commandLineOptions; }
From source file:jeplus.util.LineEnds.java
protected static Options getCommandLineOptions() { Option help = new Option("help", "print this message"); Option file = OptionBuilder.withArgName("file to convert").hasArg().withDescription( "Name of the file to be converted. If a folder name is given, all files in the folder will be converted") .isRequired().create("file"); Option style = OptionBuilder.withArgName("Line-end style").hasArg() .withDescription("Style of line ends. Choose between W or L").create("style"); Option log = OptionBuilder.withArgName("Log configuration").hasArg() .withDescription("Logger configuration file. Default=./log4j.cfg").create("log"); Options options = new Options(); options.addOption(help);// w w w . ja v a2s. co m options.addOption(file); options.addOption(style); options.addOption(log); return options; }