List of usage examples for org.apache.commons.cli OptionGroup OptionGroup
OptionGroup
From source file:org.jhub1.agent.run.cli.ParamsProcessorIQ.java
@Override protected Options getOptions() { Options optionsIQ = new Options(); Option q = getOption("q"); q.setRequired(true);// w w w . j av a 2s . c om optionsIQ.addOption(q); OptionGroup groupIQoperation = new OptionGroup(); groupIQoperation.addOption(getOption("of")); groupIQoperation.addOption(getOption("po")); optionsIQ.addOptionGroup(groupIQoperation); OptionGroup groupIQtarget = new OptionGroup(); groupIQtarget.addOption(getOption("in")); groupIQtarget.addOption(getOption("out")); optionsIQ.addOptionGroup(groupIQtarget); return optionsIQ; }
From source file:org.jhub1.agent.run.cli.ParamsProcessorSample.java
@Override protected Options getOptions() { Options optionsSamples = new Options(); Option s = getOption("s"); s.setRequired(true);/*from w w w . j ava 2s.com*/ optionsSamples.addOption(s); optionsSamples.addOption(getOption("n")); optionsSamples.addOption(getOption("v")); optionsSamples.addOption(getOption("t")); optionsSamples.addOption(getOption("g")); OptionGroup groupSampleMain = new OptionGroup(); groupSampleMain.addOption(getOption("r")); groupSampleMain.addOption(getOption("p")); optionsSamples.addOptionGroup(groupSampleMain); return optionsSamples; }
From source file:org.jini.commands.files.FindFiles.java
/** * In this method all the Command specific Command Line options are defined. * *//*ww w. j a v a2 s. c o m*/ @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("path").withDescription("Path").hasArg(true) .isRequired(false).create("p")); this.jcOptions.addOption(OptionBuilder.withLongOpt("withdetails").withDescription("With Details") .isRequired(false).create("wd")); this.jcOptions.addOption(OptionBuilder.withLongOpt("notrecursive").withDescription("Non Recursive") .hasArg(false).isRequired(false).create("nr")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("extension").withDescription("Search with extensions") .hasArg(true).isRequired(false).create("ex")); jcGroup.addOption( OptionBuilder.withLongOpt("wildcard").withDescription("Wild Card Option").hasArg().create("wc")); this.jcOptions.addOptionGroup(jcGroup); }
From source file:org.jini.commands.files.JiniCopyFiles.java
/** * In this method all the Command specific Command Line options are defined. * *///from w w w . j a v a2 s. com @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("all").withDescription("All files starting with . ") .isRequired(false).create("a")); this.jcOptions.addOption( OptionBuilder.withLongOpt("verbose").withDescription("Verbose").isRequired(false).create("v")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("hiddenfiles").withDescription("Copy Hidden Files") .isRequired(false).create("hf")); jcGroup.addOption(OptionBuilder.withLongOpt("wildcard").withDescription("Wild Card Option").hasArg(true) .isRequired(false).create("wc")); this.jcOptions.addOptionGroup(jcGroup); this.jcOptions.addOption(OptionBuilder.withLongOpt("from").withDescription("From").hasArg(true) .isRequired(false).create("f")); this.jcOptions.addOption( OptionBuilder.withLongOpt("to").withDescription("TO").hasArg(true).isRequired(false).create("t")); this.jcOptions.addOption( OptionBuilder.withLongOpt("verbose").withDescription("Verbose").isRequired(false).create("v")); }
From source file:org.jini.commands.files.List.java
/** * In this method all the Command specific Command Line options are defined. * *///from www.j a v a 2 s . com @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("path").withDescription("Path").hasArg(true) .isRequired(false).create("p")); this.jcOptions.addOption(OptionBuilder.withLongOpt("withdetails").withDescription("With Details") .isRequired(false).create("wd")); this.jcOptions.addOption(OptionBuilder.withLongOpt("result_type").withDescription("Result Type") .isRequired(false).hasArg().create("rt")); this.jcOptions.addOption(OptionBuilder.withLongOpt("showall").withDescription("Show All Files") .isRequired(false).create("all")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("filesonly").withDescription("Show Files Only").create("fo")); jcGroup.addOption(OptionBuilder.withLongOpt("dirsonly").withDescription("Show Dirs Only").create("do")); jcGroup.addOption(OptionBuilder.withLongOpt("hiddenfiles").withDescription("Hidden Files").create("hf")); jcGroup.addOption( OptionBuilder.withLongOpt("hiddendirs").withDescription("Hidden Directories").create("hd")); jcGroup.addOption( OptionBuilder.withLongOpt("wildcard").withDescription("Wild Card Option").hasArg().create("wc")); this.jcOptions.addOptionGroup(jcGroup); OptionGroup jcGroup2 = new OptionGroup(); jcGroup2.addOption(OptionBuilder.withLongOpt("orderbydate").withDescription("Order By Date") .isRequired(false).hasArg().create("obd")); jcGroup2.addOption(OptionBuilder.withLongOpt("orderbyname").withDescription("Order By Name") .isRequired(false).hasArg().create("obn")); this.jcOptions.addOptionGroup(jcGroup2); }
From source file:org.jini.commands.utils.DateCalc.java
/** * In this method all the specific Command Line options are defined. * */// ww w. j a v a2 s . c o m @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); OptionGroup jcGroup = new OptionGroup(); Option diff = new Option("diff", "difference", false, "Calculate Difference between dates."); diff.setArgs(2); jcGroup.addOption(diff); Option addDays = new Option("a", "add", false, "Add days to date."); addDays.setArgs(2); jcGroup.addOption(addDays); this.jcOptions.addOptionGroup(jcGroup); }
From source file:org.jini.commands.utils.TextConvert.java
/** * In this method all the specific Command Line options are defined. * *//* w w w . j a v a 2 s . com*/ @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("file").withDescription("File to Convert") .isRequired(false).hasArg().create("f")); //this.jcOptions.addOption(OptionBuilder.withLongOpt("outputfile").withDescription("Output File").isRequired(false).hasArg().create("of")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption( OptionBuilder.withLongOpt("texttobinary").withDescription("Convert text to Binary").create("ttb")); jcGroup.addOption( OptionBuilder.withLongOpt("binarytotext").withDescription("Convert binary to text").create("btt")); this.jcOptions.addOptionGroup(jcGroup); }
From source file:org.jini.commands.utils.TimeInZone.java
/** * In this method all the specific Command Line options are defined. * */// ww w . j a v a 2s .c o m @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("search").withDescription("Search for a TimeZone") .isRequired(false).hasArg().create("s")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("zone").withDescription("Zone Name").hasArg(true) .isRequired(false).create("z")); jcGroup.addOption(OptionBuilder.withLongOpt("list").withDescription("List").hasArg(false).isRequired(false) .create("l")); this.jcOptions.addOptionGroup(jcGroup); }
From source file:org.krysalis.barcode4j.cli.Main.java
private Options getOptions() { if (options == null) { this.options = new Options(); Option opt;/*from w w w . j a v a2s . c om*/ this.options.addOption( OptionBuilder.withLongOpt("verbose").withDescription("enable debug output").create('v')); //Group: file/stdout this.options.addOption(OptionBuilder.withLongOpt("output").withArgName("file").hasArg() .withDescription("the output filename").create('o')); //Group: config file/barcode type OptionGroup group = new OptionGroup(); group.setRequired(true); group.addOption(OptionBuilder.withArgName("file").withLongOpt("config").hasArg() .withDescription("the config file").create('c')); group.addOption(OptionBuilder.withArgName("name").withLongOpt("symbol").hasArg().withDescription( "the barcode symbology to select " + "(default settings, use -c if you want to customize)") .create('s')); this.options.addOptionGroup(group); //Output format type this.options.addOption(OptionBuilder.withArgName("format").withLongOpt("format").hasArg() .withDescription("the output format: MIME type or file " + "extension\n" + "Default: " + MimeTypes.MIME_SVG + " (SVG)") .create('f')); //Bitmap-specific options this.options.addOption(OptionBuilder.withArgName("integer").withLongOpt("dpi").hasArg() .withDescription("(for bitmaps) the image resolution in dpi\n" + "Default: 300").create('d')); this.options.addOption(OptionBuilder.withLongOpt("bw") .withDescription( "(for bitmaps) create monochrome (1-bit) " + "image instead of grayscale (8-bit)") .create()); } return this.options; }
From source file:org.linqs.psl.cli.Launcher.java
private static Options setupOptions() { Options options = new Options(); OptionGroup mainCommand = new OptionGroup(); mainCommand.addOption(Option.builder(OPERATION_INFER).longOpt(OPERATION_INFER_LONG) .desc("Run MAP inference." + " You can optionally supply a fully qualified name for an inference application" + " (defaults to " + DEFAULT_IA + ").") .hasArg().argName("inferenceMethod").optionalArg(true).build()); mainCommand.addOption(Option.builder(OPERATION_LEARN).longOpt(OPERATION_LEARN_LONG) .desc("Run weight learning." + " You can optionally supply a fully qualified name for a weight learner" + " (defaults to " + DEFAULT_WLA + ").") .hasArg().argName("learner").optionalArg(true).build()); // Make sure that help and version are in the main group so a successful run can use them. mainCommand.addOption(Option.builder(OPTION_HELP).longOpt(OPTION_HELP_LONG) .desc("Print this help message and exit").build()); mainCommand.addOption(Option.builder(OPTION_VERSION).longOpt(OPTION_VERSION_LONG) .desc("Print the PSL version and exit").build()); mainCommand.setRequired(true);/* w ww . java2 s .co m*/ options.addOptionGroup(mainCommand); options.addOption(Option.builder(OPTION_DATA).longOpt(OPTION_DATA_LONG).desc("Path to PSL data file") .hasArg().argName("path").build()); options.addOption(Option.builder().longOpt(OPTION_DB_H2_PATH) .desc("Path for H2 database file (defaults to 'cli_<user name>@<host name>' ('" + DEFAULT_H2_DB_PATH + "'))." + " Not compatible with the '--" + OPTION_DB_POSTGRESQL_NAME + "' option.") .hasArg().argName("path").build()); options.addOption(Option.builder().longOpt(OPTION_DB_POSTGRESQL_NAME) .desc("Name for the PostgreSQL database to use (defaults to " + DEFAULT_POSTGRES_DB_NAME + ")." + " Not compatible with the '--" + OPTION_DB_H2_PATH + "' option." + " Currently only local databases without credentials are supported.") .hasArg().argName("name").optionalArg(true).build()); options.addOption(Option.builder(OPTION_EVAL).longOpt(OPTION_EVAL_LONG) .desc("Run the named evaluator (" + Evaluator.class.getName() + ") on any open predicate with a 'truth' partition.") .hasArg().argName("evaluator").build()); options.addOption(Option.builder(OPTION_INT_IDS).longOpt(OPTION_INT_IDS_LONG) .desc("Use integer identifiers (UniqueIntID) instead of string identifiers (UniqueStringID).") .build()); options.addOption(Option.builder(OPTION_LOG4J).longOpt(OPTION_LOG4J_LONG) .desc("Optional log4j properties file path").hasArg().argName("path").build()); options.addOption(Option.builder(OPTION_MODEL).longOpt(OPTION_MODEL_LONG).desc("Path to PSL model file") .hasArg().argName("path").build()); options.addOption(Option.builder(OPTION_OUTPUT_DIR).longOpt(OPTION_OUTPUT_DIR_LONG) .desc("Optional path for writing results to filesystem (default is STDOUT)").hasArg() .argName("path").build()); options.addOption(Option.builder(OPTION_PROPERTIES_FILE).longOpt(OPTION_PROPERTIES_FILE_LONG) .desc("Optional PSL properties file path").hasArg().argName("path").build()); options.addOption(Option.builder(OPTION_PROPERTIES).argName("name=value") .desc("Directly specify PSL properties (overrides options set via --" + OPTION_PROPERTIES_FILE_LONG + ")." + " See https://github.com/linqs/psl/wiki/Configuration-Options for a list of available options." + " Log4j properties (properties starting with 'log4j') will be passed to the logger." + " 'log4j.threshold=DEBUG', for example, will be passed to log4j and set the global logging threshold.") .hasArg().numberOfArgs(2).valueSeparator('=').build()); return options; }