List of usage examples for org.apache.commons.cli Option setArgs
public void setArgs(int num)
From source file:org.ebayopensource.io.netty.http.snoop.HttpSnoopClient.java
private static Options buildCmdOptions() { Options options = new Options(); // user settings Option opt = new Option("s", "settings", true, "User settings for Service COLD Cache."); opt.setArgs(1); options.addOption(opt);//from w w w .j a v a 2s .c om return options; }
From source file:org.ebayopensource.scc.AppCtxInitializer.java
private Options buildCmdOptions() { Options options = new Options(); // user settings Option opt = new Option("s", "settings", true, "User settings for Service COLD Cache."); opt.setArgs(1); options.addOption(opt);/*from w w w . j a v a 2 s .c o m*/ opt = new Option("p", "proxyPort", true, "Specify proxy port, default is 32876."); opt.setArgs(1); options.addOption(opt); opt = new Option("a", "adminPort", true, "Specify admin port, default is 55321."); opt.setArgs(1); options.addOption(opt); opt = new Option("c", "cacheDir", true, "Specify cache directory, default is ./cache directory."); opt.setArgs(1); options.addOption(opt); return options; }
From source file:org.eclipse.emf.search.examples.ecore.grep.EcoreGrep.java
private Options initOptions() { Option patternOpt = new Option(PATTERN_OPT_ID, true, "pattern kind for Ecore query among 'REGEX', 'NORMAL', 'CASE' (Regular Expresion, Normal *,? Compliant Pattern, Case Sensitive) "); patternOpt.addValue("REGEX"); patternOpt.addValue("NORMAL"); patternOpt.addValue("CASE"); patternOpt.setArgs(1); Option exprOpt = new Option(EXPR_OPT_ID, true, "expression"); exprOpt.setArgs(1);//from ww w .j a va2 s. co m exprOpt.setRequired(true); Option dirOpt = new Option(DIR_OPT_ID, true, "directory list"); dirOpt.setArgs(Option.UNLIMITED_VALUES); dirOpt.setRequired(true); Option participantOpt = new Option(PARTICIPANT_OPT_ID, true, "meta-element participant list"); participantOpt.setArgs(Option.UNLIMITED_VALUES); Options options = new Options(); options.addOption(dirOpt); options.addOption(exprOpt); options.addOption(patternOpt); options.addOption(participantOpt); return options; }
From source file:org.eclipse.jubula.app.dbtool.core.DBToolClient.java
/** * {@inheritDoc}/*from ww w .j a v a 2 s.c om*/ */ protected void extendOptions(Options opt, boolean req) { // delete project final Option delOption = createOption(OPTION_DELETE, true, PAR_PROJECT, Messages.DBToolDelete, false); delOption.setArgs(2); opt.addOption(delOption); // delete all opt.addOption(createOption(OPTION_DELETE_ALL, false, null, Messages.DBToolDeleteAll, false)); //keep summary on delete opt.addOption( createOption(OPTION_KEEPSUMMARY_ON_DELETE, false, null, Messages.DBToolDeleteKeepSummary, false)); // optional directory for import/export opt.addOption(createOption(OPTION_DIR, true, PAR_DIR, Messages.DBToolDir, false)); // export all opt.addOption(createOption(OPTION_EXPORT_ALL, false, null, Messages.DBToolExportAll, false)); // export one final Option exportOption = createOption(OPTION_EXPORT, true, PAR_PROJECT, Messages.DBToolExport, false); exportOption.setArgs(2); opt.addOption(exportOption); // import opt.addOption(createOption(OPTION_IMPORT, true, PAR_IMPORT, Messages.DBToolImport, false)); }
From source file:org.esa.cci.sst.tools.BasicTool.java
private static Options createCommandLineOptions() { final Option helpOpt = new Option("help", "print this message"); final Option versionOpt = new Option("version", "print the version information and exit"); final Option verboseOpt = new Option("verbose", "be extra verbose"); final Option debugOpt = new Option("debug", "print debugging information"); final Option confFileOpt = new Option(CONFIG_FILE_OPTION_NAME, "alternative configuration file"); confFileOpt.setArgs(1); confFileOpt.setArgName("file"); confFileOpt.setType(File.class); final Option propertyOpt = new Option("D", "use value for given property"); propertyOpt.setValueSeparator('='); propertyOpt.setArgName("property=value"); propertyOpt.setArgs(2);/*from w ww. ja va 2 s.c om*/ Options options = new Options(); options.addOption(helpOpt); options.addOption(versionOpt); options.addOption(verboseOpt); options.addOption(debugOpt); options.addOption(confFileOpt); options.addOption(propertyOpt); return options; }
From source file:org.fcrepo.exporter.ArgParser.java
/** * Constructor that creates the command line options *///from w w w. j a va 2 s . com public ArgParser() { // Command Line Options cmdOptions = new Options(); // Help option final Option helpOption = new Option("h", "help", false, "Print this message"); helpOption.setRequired(false); cmdOptions.addOption(helpOption); // Mode option final Option importExportOption = new Option("m", "mode", true, "Mode: [import|export]"); importExportOption.setRequired(true); importExportOption.setArgs(1); importExportOption.setArgName("mode"); cmdOptions.addOption(importExportOption); // Resource option final Option resourceOption = new Option("r", "resource", true, "Resource (URI) to import/export"); resourceOption.setRequired(true); resourceOption.setArgs(1); resourceOption.setArgName("resource"); cmdOptions.addOption(resourceOption); // Binary Directory option final Option binDirOption = new Option("b", "binDir", true, "Directory to store binaries (files)"); binDirOption.setRequired(false); binDirOption.setArgs(1); binDirOption.setArgName("binDir"); cmdOptions.addOption(binDirOption); // Description Directory option final Option descDirOption = new Option("d", "descDir", true, "Directory to store RDF descriptions"); descDirOption.setRequired(true); descDirOption.setArgs(1); descDirOption.setArgName("descDir"); cmdOptions.addOption(descDirOption); // RDF extension option final Option rdfExtOption = new Option("x", "rdfExt", true, "RDF filename extension (default: " + DEFAULT_RDF_EXT); rdfExtOption.setRequired(false); rdfExtOption.setArgs(1); rdfExtOption.setArgName("rdfExt"); cmdOptions.addOption(rdfExtOption); // RDF language option final Option rdfLangOption = new Option("l", "rdfLang", true, "RDF language (default: " + DEFAULT_RDF_LANG); rdfLangOption.setRequired(false); rdfLangOption.setArgs(1); rdfLangOption.setArgName("rdfLang"); cmdOptions.addOption(rdfLangOption); }
From source file:org.fcrepo.importer.ArgParser.java
/** * Constructor that creates the command line options *///from www . j a v a 2 s . com public ArgParser() { // Command Line Options cmdOptions = new Options(); // Help option final Option helpOption = new Option("h", "help", false, "Print this message"); helpOption.setRequired(false); cmdOptions.addOption(helpOption); // Mode option final Option importExportOption = new Option("m", "mode", true, "Mode: [import|export]"); importExportOption.setRequired(true); importExportOption.setArgs(1); importExportOption.setArgName("mode"); cmdOptions.addOption(importExportOption); }
From source file:org.fusesource.mop.support.OptionBuilder.java
public Option op() { Option option = new Option(id != null ? id : " ", name, arg != null || args > 0, description); option.setRequired(required);/*from w w w . j a v a2s . c o m*/ option.setType(type); option.setValueSeparator(sperator); if (arg != null && args == -1) { args = 1; } option.setArgs(args); option.setArgName(arg); return option; }
From source file:org.janusgraph.codepipelines.AwsCodePipelinesCi.java
private static Option createOneArgOption(final String longOpt, final String description, final boolean required) { final Option o = new Option(NULL_SHORT_OPT, longOpt, HAS_ARG, description); o.setRequired(required);/*from ww w . j a va 2s.c o m*/ o.setArgs(1); return o; }
From source file:org.jax.bioinfdata.genocall.ConvertAlchemyCallsToHDF5Main.java
/** * the main entry point/* w w w . java 2 s . c o m*/ * @param args command line args * @throws IOException * @throws IllegalFormatException */ public static void main(String[] args) throws IllegalFormatException, IOException { // Deal with the options. CommandLineParser parser = new GnuParser(); Options options = new Options(); CommandLine commandLine = null; final Option helpOption; { helpOption = new Option("help", "Print this help and exit"); helpOption.setRequired(false); options.addOption(helpOption); } final Option genoFileOption; { genoFileOption = new Option("alchemygenos", "the genotype calls output from alchemy"); genoFileOption.setRequired(true); genoFileOption.setArgs(1); genoFileOption.setArgName("file name"); options.addOption(genoFileOption); } final Option outputFileOption; { outputFileOption = new Option("hdf5out", "the file to write HDF5 output to"); outputFileOption.setRequired(true); outputFileOption.setArgs(1); outputFileOption.setArgName("file name"); options.addOption(outputFileOption); } try { commandLine = parser.parse(options, args); // See if we just need to print the help options. if (commandLine.hasOption(helpOption.getOpt())) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp("alchtohdf5", options); } else { final String genoFileName = commandLine.getOptionValue(genoFileOption.getOpt()); final String outFileName = commandLine.getOptionValue(outputFileOption.getOpt()); final FlatFileReader genoFFR = new FlatFileReader(new FileReader(genoFileName), CommonFlatFileFormat.TAB_DELIMITED_UNIX); GenotypeCallMatrix genoMat = GenotypesFlatFile.readAlchemyGenoCalls(genoFFR); genoFFR.close(); IHDF5Factory hdf5Fac = HDF5FactoryProvider.get(); File hdf5File = new File(outFileName); if (hdf5File.exists()) { if (!hdf5File.delete()) { throw new IOException("failed to overwrite \"" + outFileName + "\""); } } IHDF5Writer hdf5Writer = hdf5Fac.open(hdf5File); HDF5GenotypeCallMatrix hdf5GenoMat = new HDF5GenotypeCallMatrix(hdf5Writer); AbstractGenotypeCallMatrix.copyGenoMatrix(genoMat, hdf5GenoMat); hdf5Writer.close(); } } catch (ParseException ex) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp("fftohdf5", options); System.exit(-1); } }