List of usage examples for org.apache.commons.cli OptionGroup addOption
public OptionGroup addOption(Option option)
Option
to this group. From source file:edu.internet2.middleware.psp.PspOptions.java
/** * Construct the <code>Options</code>. */// ww w . jav a2s. com private void initOptions() { options = new Options(); OptionGroup requestOp = new OptionGroup(); requestOp.setRequired(true); requestOp.addOption(Mode.calc.getOption()); requestOp.addOption(Mode.diff.getOption()); requestOp.addOption(Mode.sync.getOption()); requestOp.addOption(Mode.bulkCalc.getOption()); requestOp.addOption(Mode.bulkDiff.getOption()); requestOp.addOption(Mode.bulkSync.getOption()); options.addOptionGroup(requestOp); OptionGroup returnData = new OptionGroup(); returnData.addOption(Opts.returnData.getOption()); returnData.addOption(Opts.returnEverything.getOption()); returnData.addOption(Opts.returnIdentifier.getOption()); returnData.setRequired(false); options.addOptionGroup(returnData); options.addOption(Opts.conf.getOption()); options.addOption(Opts.entityName.getOption()); options.addOption(Opts.interval.getOption()); options.addOption(Opts.iterations.getOption()); options.addOption(Opts.logSpml.getOption()); options.addOption(Opts.output.getOption()); options.addOption(Opts.requestID.getOption()); options.addOption(Opts.printRequests.getOption()); options.addOption(Opts.targetID.getOption()); options.addOption(Opts.omitDiffResponses.getOption()); options.addOption(Opts.omitSyncResponses.getOption()); }
From source file:de.bmw.yamaica.common.console.CommandExecuter.java
private OptionGroup createOptionGroup(IConfigurationElement optionGroupConfiguration, Map<String, IConfigurationElement> referenceableOptionConfigurations) { String required = optionGroupConfiguration.getAttribute(OPTION_GROUP_REQUIRED_ATTRIBUTE_NAME); OptionGroup optionGroup = new OptionGroup(); optionGroup.setRequired(Boolean.parseBoolean(required)); for (IConfigurationElement optionConfiguration : optionGroupConfiguration.getChildren()) { Option option = getOptionByConfiguration(optionConfiguration, referenceableOptionConfigurations); if (null != option) { optionGroup.addOption(option); }//from w ww. ja v a 2 s.c om } return optionGroup; }
From source file:mod.org.dcm4che2.tool.DcmQR.java
private static CommandLine parse(String[] args) { Options opts = new Options(); OptionBuilder.withArgName("name"); OptionBuilder.hasArg();/* ww w . j av a 2 s. c o m*/ OptionBuilder.withDescription("set device name, use DCMQR by default"); opts.addOption(OptionBuilder.create("device")); OptionBuilder.withArgName("aet[@host][:port]"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set AET, local address and listening port of local" + "Application Entity, use device name and pick up any valid " + "local address to bind the socket by default"); opts.addOption(OptionBuilder.create("L")); OptionBuilder.withArgName("username"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "enable User Identity Negotiation with specified username and " + " optional passcode"); opts.addOption(OptionBuilder.create("username")); OptionBuilder.withArgName("passcode"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "optional passcode for User Identity Negotiation, " + "only effective with option -username"); opts.addOption(OptionBuilder.create("passcode")); opts.addOption("uidnegrsp", false, "request positive User Identity Negotation response, " + "only effective with option -username"); OptionBuilder.withArgName("NULL|3DES|AES"); OptionBuilder.hasArg(); OptionBuilder.withDescription("enable TLS connection without, 3DES or AES encryption"); opts.addOption(OptionBuilder.create("tls")); OptionGroup tlsProtocol = new OptionGroup(); tlsProtocol.addOption(new Option("tls1", "disable the use of SSLv3 and SSLv2 for TLS connections")); tlsProtocol.addOption(new Option("ssl3", "disable the use of TLSv1 and SSLv2 for TLS connections")); tlsProtocol.addOption(new Option("no_tls1", "disable the use of TLSv1 for TLS connections")); tlsProtocol.addOption(new Option("no_ssl3", "disable the use of SSLv3 for TLS connections")); tlsProtocol.addOption(new Option("no_ssl2", "disable the use of SSLv2 for TLS connections")); opts.addOptionGroup(tlsProtocol); opts.addOption("noclientauth", false, "disable client authentification for TLS"); OptionBuilder.withArgName("file|url"); OptionBuilder.hasArg(); OptionBuilder .withDescription("file path or URL of P12 or JKS keystore, resource:tls/test_sys_1.p12 by default"); opts.addOption(OptionBuilder.create("keystore")); OptionBuilder.withArgName("password"); OptionBuilder.hasArg(); OptionBuilder.withDescription("password for keystore file, 'secret' by default"); opts.addOption(OptionBuilder.create("keystorepw")); OptionBuilder.withArgName("password"); OptionBuilder.hasArg(); OptionBuilder .withDescription("password for accessing the key in the keystore, keystore password by default"); opts.addOption(OptionBuilder.create("keypw")); OptionBuilder.withArgName("file|url"); OptionBuilder.hasArg(); OptionBuilder.withDescription("file path or URL of JKS truststore, resource:tls/mesa_certs.jks by default"); opts.addOption(OptionBuilder.create("truststore")); OptionBuilder.withArgName("password"); OptionBuilder.hasArg(); OptionBuilder.withDescription("password for truststore file, 'secret' by default"); opts.addOption(OptionBuilder.create("truststorepw")); OptionBuilder.withArgName("aet"); OptionBuilder.hasArg(); OptionBuilder .withDescription("retrieve instances of matching entities by C-MOVE to specified destination."); opts.addOption(OptionBuilder.create("cmove")); opts.addOption("nocfind", false, "retrieve instances without previous query - unique keys must be specified by -q options"); opts.addOption("cget", false, "retrieve instances of matching entities by C-GET."); OptionBuilder.withArgName("cuid[:ts]"); OptionBuilder.hasArgs(); OptionBuilder.withDescription("negotiate support of specified Storage SOP Class and Transfer " + "Syntaxes. The Storage SOP Class may be specified by its UID " + "or by one of following key words:\n" + "CR - Computed Radiography Image Storage\n" + "CT - CT Image Storage\n" + "MR - MRImageStorage\n" + "US - Ultrasound Image Storage\n" + "NM - Nuclear Medicine Image Storage\n" + "PET - PET Image Storage\n" + "SC - Secondary Capture Image Storage\n" + "XA - XRay Angiographic Image Storage\n" + "XRF - XRay Radiofluoroscopic Image Storage\n" + "DX - Digital X-Ray Image Storage for Presentation\n" + "MG - Digital Mammography X-Ray Image Storage for Presentation\n" + "PR - Grayscale Softcopy Presentation State Storage\n" + "KO - Key Object Selection Document Storage\n" + "SR - Basic Text Structured Report Document Storage\n" + "The Transfer Syntaxes may be specified by a comma " + "separated list of UIDs or by one of following key " + "words:\n" + "IVRLE - offer only Implicit VR Little Endian " + "Transfer Syntax\n" + "LE - offer Explicit and Implicit VR Little Endian " + "Transfer Syntax\n" + "BE - offer Explicit VR Big Endian Transfer Syntax\n" + "DEFL - offer Deflated Explicit VR Little " + "Endian Transfer Syntax\n" + "JPLL - offer JEPG Loss Less Transfer Syntaxes\n" + "JPLY - offer JEPG Lossy Transfer Syntaxes\n" + "MPEG2 - offer MPEG2 Transfer Syntax\n" + "NOPX - offer No Pixel Data Transfer Syntax\n" + "NOPXD - offer No Pixel Data Deflate Transfer Syntax\n" + "If only the Storage SOP Class is specified, all " + "Transfer Syntaxes listed above except No Pixel Data " + "and No Pixel Data Delflate Transfer Syntax are " + "offered."); opts.addOption(OptionBuilder.create("cstore")); OptionBuilder.withArgName("dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("store received objects into files in specified directory <dir>." + " Do not store received objects by default."); opts.addOption(OptionBuilder.create("cstoredest")); opts.addOption("ivrle", false, "offer only Implicit VR Little Endian Transfer Syntax."); OptionBuilder.withArgName("maxops"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "maximum number of outstanding C-MOVE-RQ " + "it may invoke asynchronously, 1 by default."); opts.addOption(OptionBuilder.create("async")); OptionBuilder.withArgName("maxops"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximum number of outstanding storage operations performed " + "asynchronously, unlimited by default."); opts.addOption(OptionBuilder.create("storeasync")); opts.addOption("noextneg", false, "disable extended negotiation."); opts.addOption("rel", false, "negotiate support of relational queries and retrieval."); opts.addOption("datetime", false, "negotiate support of combined date and time attribute range matching."); opts.addOption("fuzzy", false, "negotiate support of fuzzy semantic person name attribute matching."); opts.addOption("retall", false, "negotiate private FIND SOP Classes " + "to fetch all available attributes of matching entities."); opts.addOption("blocked", false, "negotiate private FIND SOP Classes " + "to return attributes of several matching entities per FIND " + "response."); opts.addOption("vmf", false, "negotiate private FIND SOP Classes to " + "return attributes of legacy CT/MR images of one series as " + "virtual multiframe object."); opts.addOption("pdv1", false, "send only one PDV in one P-Data-TF PDU, pack command and data " + "PDV in one P-DATA-TF PDU by default."); opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default"); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for TCP connect, no timeout by default"); opts.addOption(OptionBuilder.create("connectTO")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("delay in ms for Socket close after sending A-ABORT, 50ms by default"); opts.addOption(OptionBuilder.create("soclosedelay")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("period in ms to check for outstanding DIMSE-RSP, 10s by default"); opts.addOption(OptionBuilder.create("reaper")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving C-FIND-RSP, 60s by default"); opts.addOption(OptionBuilder.create("cfindrspTO")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving C-MOVE-RSP and C-GET RSP, 600s by default"); opts.addOption(OptionBuilder.create("cmoverspTO")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving C-GET-RSP and C-MOVE RSP, 600s by default"); opts.addOption(OptionBuilder.create("cgetrspTO")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving A-ASSOCIATE-AC, 5s by default"); opts.addOption(OptionBuilder.create("acceptTO")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving A-RELEASE-RP, 5s by default"); opts.addOption(OptionBuilder.create("releaseTO")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximal length in KB of received P-DATA-TF PDUs, 16KB by default"); opts.addOption(OptionBuilder.create("rcvpdulen")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default"); opts.addOption(OptionBuilder.create("sndpdulen")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB"); opts.addOption(OptionBuilder.create("sorcvbuf")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB"); opts.addOption(OptionBuilder.create("sosndbuf")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("minimal buffer size to write received object to file, 1KB by default"); opts.addOption(OptionBuilder.create("filebuf")); OptionGroup qrlevel = new OptionGroup(); OptionBuilder.withDescription("perform patient level query, multiple " + "exclusive with -S and -I, perform study level query " + "by default."); OptionBuilder.withLongOpt("patient"); qrlevel.addOption(OptionBuilder.create("P")); OptionBuilder.withDescription("perform series level query, multiple " + "exclusive with -P and -I, perform study level query " + "by default."); OptionBuilder.withLongOpt("series"); qrlevel.addOption(OptionBuilder.create("S")); OptionBuilder.withDescription("perform instance level query, multiple " + "exclusive with -P and -S, perform study level query " + "by default."); OptionBuilder.withLongOpt("image"); qrlevel.addOption(OptionBuilder.create("I")); OptionBuilder.withArgName("cuid"); OptionBuilder.hasArgs(); OptionBuilder.withDescription("negotiate addition private C-FIND SOP " + "class with specified UID"); opts.addOption(OptionBuilder.create("cfind")); opts.addOptionGroup(qrlevel); OptionBuilder.withArgName("[seq/]attr=value"); OptionBuilder.hasArgs(); OptionBuilder.withValueSeparator('='); OptionBuilder.withDescription( "specify matching key. attr can be " + "specified by name or tag value (in hex), e.g. PatientName " + "or 00100010. Attributes in nested Datasets can " + "be specified by including the name/tag value of " + "the sequence attribute, e.g. 00400275/00400009 " + "for Scheduled Procedure Step ID in the Request " + "Attributes Sequence"); opts.addOption(OptionBuilder.create("q")); OptionBuilder.withArgName("attr"); OptionBuilder.hasArgs(); OptionBuilder.withDescription( "specify additional return key. attr can " + "be specified by name or tag value (in hex)."); opts.addOption(OptionBuilder.create("r")); opts.addOption("nodefret", false, "only inlcude return keys specified by -r into the request."); OptionBuilder.withArgName("num"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "cancel query after receive of specified " + "number of responses, no cancel by default"); opts.addOption(OptionBuilder.create("C")); OptionBuilder.withArgName("aet"); OptionBuilder.hasArg(); OptionBuilder.withDescription("retrieve matching objects to specified " + "move destination."); opts.addOption(OptionBuilder.create("cmove")); opts.addOption("evalRetrieveAET", false, "Only Move studies not allready stored on destination AET"); opts.addOption("lowprior", false, "LOW priority of the C-FIND/C-MOVE operation, MEDIUM by default"); opts.addOption("highprior", false, "HIGH priority of the C-FIND/C-MOVE operation, MEDIUM by default"); OptionBuilder.withArgName("num"); OptionBuilder.hasArg(); OptionBuilder.withDescription("repeat query (and retrieve) several times"); opts.addOption(OptionBuilder.create("repeat")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("delay in ms between repeated query (and retrieve), no delay by default"); opts.addOption(OptionBuilder.create("repeatdelay")); opts.addOption("reuseassoc", false, "Reuse association for repeated query (and retrieve)"); opts.addOption("closeassoc", false, "Close association between repeated query (and retrieve)"); opts.addOption("h", "help", false, "print this message"); opts.addOption("V", "version", false, "print the version information and exit"); CommandLine cl = null; try { cl = new GnuParser().parse(opts, args); } catch (ParseException e) { exit("dcmqr: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption('V')) { Package p = DcmQR.class.getPackage(); System.out.println("dcmqr v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption('h') || cl.getArgList().size() != 1) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:com.continuent.tungsten.common.security.PasswordManagerCtrl.java
/** * Setup command line options/*from w w w . ja v a2s . com*/ */ @SuppressWarnings("static-access") private void setupCommandLine() { // --- Options on the command line --- Option help = OptionBuilder.withLongOpt(HELP).withDescription("Displays this message").create(_HELP); Option file = OptionBuilder.withLongOpt(FILE).withArgName("filename").hasArgs() .withDescription("Location of the " + SecurityConf.SECURITY_PROPERTIES_FILE_NAME + " file") .create(_FILE); // Mutually excluding options OptionGroup optionGroup = new OptionGroup(); authenticate = OptionBuilder.withLongOpt(AUTHENTICATE).hasArgs(2).withArgName("username> <password") .withDescription("Authenticates a user with given password").create(_AUTHENTICATE); create = OptionBuilder.withLongOpt(CREATE).hasArgs(2).withArgName("username> <password") .withDescription("Creates or Updates a user").create(_CREATE); Option delete = OptionBuilder.withLongOpt(DELETE).withArgName("username").hasArgs() .withDescription("Deletes a user").create(_DELETE); optionGroup.addOption(authenticate); optionGroup.addOption(create); optionGroup.addOption(delete); optionGroup.setRequired(true); // At least 1 command required Option targetApplication = OptionBuilder.withLongOpt(TARGET_APPLICATION).withArgName("target").hasArgs() .withDescription("Target application: " + getListOfClientApplicationType()) .create(_TARGET_APPLICATION); // --- Options replacing parameters from security.properties --- Option encryptedPassword = OptionBuilder.withLongOpt(ENCRYPTED_PASSWORD).withArgName("encrypt password") .withDescription("Encrypts the password").create(_ENCRYPTED_PASSWORD); Option truststoreLocation = OptionBuilder.withLongOpt(TRUSTSTORE_LOCATION).withArgName("filename").hasArg() .withDescription("Location of the tuststore file").create(_TRUSTSTORE_LOCATION); Option truststorePassword = OptionBuilder.withLongOpt(TRUSTSTORE_PASSWORD).withArgName("password").hasArg() .withDescription("Password for the truststore file").create(_TRUSTSTORE_PASSWORD); Option keystoreLocation = OptionBuilder.withLongOpt(KEYSTORE_LOCATION).withArgName("filename").hasArg() .withDescription("Location of the keystore file").create(_KEYSTORE_LOCATION); Option keystorePassword = OptionBuilder.withLongOpt(KEYSTORE_PASSWORD).withArgName("password").hasArg() .withDescription("Password for the keystore file").create(_KEYSTORE_PASSWORD); Option passwordFileLocation = OptionBuilder.withLongOpt(PASSWORD_FILE_LOCATION).withArgName("filename") .hasArg().withDescription("Location of the password file").create(_PASSWORD_FILE_LOCATION); // --- Add options to the list --- // --- Help this.helpOptions.addOption(help); // --- Program command line options this.options.addOptionGroup(optionGroup); this.options.addOption(file); this.options.addOption(help); this.options.addOption(encryptedPassword); this.options.addOption(truststoreLocation); this.options.addOption(truststorePassword); this.options.addOption(keystoreLocation); this.options.addOption(keystorePassword); this.options.addOption(passwordFileLocation); this.options.addOption(targetApplication); }
From source file:edu.usc.scrc.PriorityPruner.CommandLineOptions.java
/** * Initiates options with input arguments from user, and adds them to a * collection./*from w w w . j a v a2s . c om*/ * * @return an Options-object, which is a collection of all Option-objects */ private Options initOptions() { // when defining required options/changing descriptions, notice the // temporary solution for printing out missing required options (when a // MissingOptionException is caught) Options options = new Options(); //max-distance Option maxDistance = createOptionOneName(1, "integer", "Max distance in base pairs between SNPs to calculate pair-wise LD. Default is 500,000.", false, "max_distance"); //min-maf Option minMaf = createOptionOneName(1, "float", "Minimum minor allele frequency (MAF) for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.", false, "min_maf"); //min-hwe // Option minHwPvalue = createOptionOneName(1, "float", // "Minimum Hardy-Weinberg p-value for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.", false, "min_hwe"); //min-snp-callrate Option minSnpCallRate = createOptionOneName(1, "float", "Minimum SNP call rate for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.", false, "min_snp_callrate"); //min-design-score Option minDesignScore = createOptionOneName(1, "float", "Minimum design score for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.", false, "min_design_score"); // Option absMinDesignScore = createOptionTwoNames(1, // "0.0 - no upper limit", "absmindesignscore", // "Set absolute minimum design score value allowed", false, // "amds"); //metric Option metric = createOptionOneName(2, "name, weight", "Specify name and weight of a metric.", false, "metric"); //st Option surrogateThreshold = createOptionOneName(2, "p-value, num_surrogates", "Add surrogate-threshold, specify both p-value and the number of surrogates", false, "st"); //r2t Option r2Threshold = createOptionOneName(2, "p-value, r2", "Add p-value dependent r^2-threshold, specify both p-value and r^2-threshold.", false, "r2t"); //r2 Option fixedR2 = createOptionOneName(1, "r2", "Add a fixed r^2-threshold (valid for all p-values)", false, "r2"); //chromosome Option chromosome = createOptionOneName(1, "chromosome", "Specify chromosome, if none chosen - all chromosomes will be included", false, "chr"); //out Option outputFile = createOptionOneName(1, "output_prefix", "Define output file prefix.", false, "out"); //force_include Option forceIncludeFilePath = createOptionOneName(1, "filename", "Specify file path for a file containing SNPs that are to be force included", false, "force_include"); //do_not_pick_force_included_first Option doNotPickForceIncludedFirst = createOptionOneName(0, "none", "Force-included SNPs are processed in the same order as all other SNPs (i.e., by increasing p-value)", false, "do_not_pick_force_included_first"); //snp_table Option snpTable = createOptionOneName(1, "input_filename", "Specify file path for SNP input table", false, "snp_table"); //tped Option tped = createOptionOneName(1, "input_filename", "Specify file path for tped file", false, "tped"); //tfam Option tfam = createOptionOneName(1, "input_filename", "Specify file path for tfam file", false, "tfam"); //tfile Option tfile = createOptionOneName(1, "input_file_prefix", "Specify file prefix of tped and tfam files", false, "tfile"); //add_surrogate_for_non_passing_index_snps Option additionalSurrogates = createOptionOneName(0, "none", "Specify that an additional surrogate will be added instead of choosing a new index SNP, in the case current index SNP does not pass the design score minimum", false, "add_surrogate_for_non_passing_index_snps"); //verbose Option verbose = createOptionOneName(0, "none", "Specify that detailed information should be printed out and stored in the log file", false, "verbose"); //outputLDTable Option outputLDTable = createOptionOneName(0, "none", "Directs the software to output a table containing all LD calculations made by the software", false, "ld"); //remove Option remove = createOptionOneName(1, "filename", "Specify file path for a file containing family ID and individual ID of individuals that should be removed from current sample", false, "remove"); //keep Option keep = createOptionOneName(1, "filename", "Specify file path for a file containing family ID and individual ID of individuals that should be kept, rest will be removed from current sample", false, "keep"); //keep_random Option keepRandom = createOptionOneName(1, "float", "Specify a percentage value (as a decimal) to get a random selection of individuals of that size", false, "keep_random"); //no_surrogates_for_force_included_snps Option noSurrogatesForForceIncluded = createOptionOneName(0, "none", "Specify that surrogates should not be added for force included SNPs", false, "no_surrogates_for_force_included_snps"); Option seed = createOptionOneName(1, "long", "Integer seed for random number generator. If not specified, a random seed is used instead.", false, "seed"); //help Option help = createOptionTwoNames(0, "none", "help", "Print help", false, "h"); // adds a special set of sample options that are mutually exclusive, to // an option group OptionGroup keepRemoveGroup = new OptionGroup(); keepRemoveGroup.addOption(remove); keepRemoveGroup.addOption(keep); keepRemoveGroup.addOption(keepRandom); // adds the two different r^2-options to an option group, to make them // mutually exclusive OptionGroup r2Group = new OptionGroup(); r2Group.addOption(r2Threshold); r2Group.addOption(fixedR2); //r2Group.setRequired(true); // adds all options to an option collection options.addOption(maxDistance); options.addOption(minMaf); //options.addOption(minHwPvalue); options.addOption(minSnpCallRate); options.addOption(minDesignScore); //options.addOption(absMinDesignScore); options.addOption(metric); options.addOption(surrogateThreshold); options.addOption(r2Threshold); options.addOption(chromosome); options.addOption(outputFile); options.addOption(forceIncludeFilePath); options.addOption(doNotPickForceIncludedFirst); options.addOption(snpTable); options.addOption(tped); options.addOption(tfam); options.addOption(tfile); options.addOption(additionalSurrogates); options.addOption(verbose); options.addOption(outputLDTable); options.addOption(noSurrogatesForForceIncluded); options.addOption(r2Threshold); options.addOption(fixedR2); options.addOption(seed); options.addOption(help); options.addOptionGroup(keepRemoveGroup); options.addOptionGroup(r2Group); return options; }
From source file:net.sourceforge.squirrel_sql.plugins.dbcopy.cli.CommandLineArgumentProcessor.java
@SuppressWarnings("static-access") private void createOptions() { Option sourceOption = OptionBuilder.hasArg().isRequired().withLongOpt(SOURCE_SESSION) .withDescription("The name of the source alias to copy tables from").create(); options.addOption(sourceOption);/*from w w w . j a va2 s . co m*/ Option destOption = OptionBuilder.hasArg().isRequired().withLongOpt(DEST_SESSION) .withDescription("The name of the destination alias to copy tables to").create(); options.addOption(destOption); Option sourceSchemaOption = OptionBuilder.hasArg().withLongOpt(SOURCE_SCHEMA) .withDescription("The source schema to copy tables from").create(); Option sourceCatalogOption = OptionBuilder.hasArg().withLongOpt(SOURCE_CATALOG) .withDescription("The source catalog to copy tables from").create(); OptionGroup sourceSchemaGroup = new OptionGroup(); sourceSchemaGroup.setRequired(true); sourceSchemaGroup.addOption(sourceSchemaOption); sourceSchemaGroup.addOption(sourceCatalogOption); options.addOptionGroup(sourceSchemaGroup); Option listOption = OptionBuilder.hasArg().withLongOpt(TABLE_LIST) .withDescription("A comma-delimited list of tables to copy").create(); Option patternOption = OptionBuilder.hasArg().withLongOpt(TABLE_PATTERN) .withDescription("A regexp pattern to match source table names").create(); OptionGroup tableGroup = new OptionGroup(); tableGroup.setRequired(true); tableGroup.addOption(listOption); tableGroup.addOption(patternOption); options.addOptionGroup(tableGroup); Option destSchemaOption = OptionBuilder.hasArg().withLongOpt(DEST_SCHEMA) .withDescription("The destination schema to copy tables into").create(); Option destCatalogOption = OptionBuilder.hasArg().withLongOpt(DEST_CATALOG) .withDescription("The destination catalog to copy tables into").create(); OptionGroup destSchemaGroup = new OptionGroup(); destSchemaGroup.setRequired(true); destSchemaGroup.addOption(destSchemaOption); destSchemaGroup.addOption(destCatalogOption); options.addOptionGroup(destSchemaGroup); }
From source file:net.timbusproject.extractors.debiansoftwareextractor.CLI.java
private OptionGroup createOptionGroup(boolean required, Option... options) { OptionGroup group = new OptionGroup(); for (Option option : options) group.addOption(option); group.setRequired(required);/* www. j a v a 2 s . co m*/ return group; }
From source file:nl.mikero.turntopassage.commandline.Application.java
private void execute(String[] args) { // Options//from w ww . j ava 2 s. c o m final Options options = new Options(); Option input = OptionBuilder.hasArg().withArgName("file").withDescription("location of input HTML file") .withLongOpt(OPT_FILE).create('f'); Option output = OptionBuilder.hasArg().withArgName("file").withDescription("location of output EPUB file") .withLongOpt(OPT_OUTPUT).create('o'); options.addOption(input); options.addOption(output); OptionGroup infoGroup = new OptionGroup(); infoGroup.addOption(new Option(OPT_HELP, "display this help and exit")); infoGroup.addOption(new Option(OPT_VERSION, "output version information and exit")); options.addOptionGroup(infoGroup); // Parse CommandLineParser parser = new BasicParser(); try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption(OPT_VERSION)) { System.out.println("TurnToPassage.Transformer 0.0.1"); System.out.println("Copyright (C) 2015 Mike Rombout"); System.out.println("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>"); System.out.println("This is free software: you are free to change and redistribute it."); System.out.println("There is NO WARRANTY, to the extend permitted by law."); System.exit(0); } else if (cmd.hasOption(OPT_HELP)) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("turntopassage", options, true); System.exit(0); } else { InputStream inputStream = System.in; OutputStream outputStream = System.out; if (cmd.hasOption(OPT_FILE)) { String fileArg = cmd.getOptionValue(OPT_FILE); try { inputStream = new BufferedInputStream(new FileInputStream(new File(fileArg))); } catch (FileNotFoundException e) { LOGGER.error("Input file {} could not be found.", fileArg, e); System.exit(1); } } if (cmd.hasOption(OPT_OUTPUT)) { String outputArg = cmd.getOptionValue(OPT_OUTPUT); try { outputStream = new BufferedOutputStream(new FileOutputStream(new File(outputArg))); } catch (FileNotFoundException e) { LOGGER.error("Output file {} could not be found.", outputArg, e); System.exit(1); } } twineService.transform(inputStream, outputStream); System.exit(0); } } catch (ParseException e) { LOGGER.error("Error: {}", e.getMessage(), e); } System.exit(1); }
From source file:org.apache.accumulo.core.util.shell.commands.AddAuthsCommand.java
@Override public Options getOptions() { final Options o = new Options(); final OptionGroup setOrClear = new OptionGroup(); scanOptAuths = new Option("s", "scan-authorizations", true, "scan authorizations to set"); scanOptAuths.setArgName("comma-separated-authorizations"); setOrClear.addOption(scanOptAuths); setOrClear.setRequired(true);/* w ww . j av a 2 s . c o m*/ o.addOptionGroup(setOrClear); userOpt = new Option(Shell.userOption, "user", true, "user to operate on"); userOpt.setArgName("user"); o.addOption(userOpt); return o; }
From source file:org.apache.accumulo.core.util.shell.commands.ConfigCommand.java
@Override public Options getOptions() { final Options o = new Options(); final OptionGroup og = new OptionGroup(); final OptionGroup tgroup = new OptionGroup(); tableOpt = new Option(Shell.tableOption, "table", true, "table to display/set/delete properties for"); deleteOpt = new Option("d", "delete", true, "delete a per-table property"); setOpt = new Option("s", "set", true, "set a per-table property"); filterOpt = new Option("f", "filter", true, "show only properties that contain this string"); disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output"); outputFileOpt = new Option("o", "output", true, "local file to write the scan output to"); namespaceOpt = new Option(Shell.namespaceOption, "namespace", true, "namespace to display/set/delete properties for"); tableOpt.setArgName("table"); deleteOpt.setArgName("property"); setOpt.setArgName("property=value"); filterOpt.setArgName("string"); outputFileOpt.setArgName("file"); namespaceOpt.setArgName("namespace"); og.addOption(deleteOpt); og.addOption(setOpt);//from ww w. j a v a 2s . c o m og.addOption(filterOpt); tgroup.addOption(tableOpt); tgroup.addOption(namespaceOpt); o.addOptionGroup(tgroup); o.addOptionGroup(og); o.addOption(disablePaginationOpt); o.addOption(outputFileOpt); return o; }