List of usage examples for org.apache.commons.cli OptionBuilder withDescription
public static OptionBuilder withDescription(String newDescription)
From source file:admixture.parameter.Parameter.java
@SuppressWarnings("static-access") public void commandInitial() { ops.addOption(OptionBuilder.withDescription("collapse other than nuclear families").create(cmd_collapse)); ops.addOption(OptionBuilder.withDescription("method for case-control sample.").create(cmd_cc)); ops.addOption(OptionBuilder.withDescription("method I for pedigree-based sample.").create(cmd_pi)); ops.addOption(OptionBuilder.withDescription("method II for pedigree-based sample.").create(cmd_pii)); ops.addOption(OptionBuilder.withDescription("method I for unrelated ans family samples.").create(cmd_ui)); ops.addOption(OptionBuilder.withDescription("method II for unrelated ans family samples.").create(cmd_uii)); ops.addOption(OptionBuilder.withDescription("specify the .ped and .map files").hasArg().create(cmd_file)); // ops.addOption(OptionBuilder.withDescription("specify the .ped file.") // .hasArg().create(cmd_ped)); // ops.addOption(OptionBuilder.withDescription("specify the .map file.") // .hasArg().create(cmd_map)); ops.addOption(//w ww . j a v a 2s. c om OptionBuilder.withDescription("specify the .bed, .bim and .fam files.").hasArg().create(cmd_bfile)); // ops.addOption(OptionBuilder.withDescription("specify the .bed file.") // .hasArg().create(cmd_bed)); // ops.addOption(OptionBuilder.withDescription("specify the .bim file.") // .hasArg().create(cmd_bim)); // ops.addOption(OptionBuilder.withDescription("specify the .fam file.") // .hasArg().create(cmd_fam)); ops.addOption(OptionBuilder.withDescription("specify the phenotype file.").hasArg().create(cmd_covar)); ops.addOption(OptionBuilder.withDescription("the phenotype file has header") .withLongOpt(cmd_covar_header_long).create(cmd_covar_header)); ops.addOption(OptionBuilder.withDescription("specify 1 or more covariates by number.").hasArgs() .withLongOpt(cmd_covar_number_long).create(cmd_covar_number)); // ops.addOption(OptionBuilder // .withDescription("specify 1 or more covariates by name.") // .hasArgs().withLongOpt(cmd_covar_name_long).create(cmd_covar_name)); ops.addOption(OptionBuilder.withDescription("linear regression").create(cmd_linear)); ops.addOption(OptionBuilder.withDescription("logistic regression").create(cmd_logistic)); ops.addOption( OptionBuilder.withDescription("specify regions to select snps.").hasArgs().create(cmd_region)); // ops.addOption(OptionBuilder.withDescription("specify genes.").hasArgs() // .create(cmd_gene)); ops.addOption(OptionBuilder.withDescription("specify a genelist.").hasArgs().withLongOpt(cmd_gene_list_long) .create(cmd_gene_list)); ops.addOption(OptionBuilder.withDescription("specify gene window in kb.").hasArg() .withLongOpt(cmd_gene_window_long).create(cmd_gene_window)); ops.addOption(OptionBuilder.withDescription("make snp lists with respect genes") .withLongOpt(cmd_snp2gene_list).create(cmd_snp2genelist)); ops.addOption(OptionBuilder.withDescription("make snp lists with respect genes") .withLongOpt(cmd_snp2gene_mlist).create(cmd_snp2genemlist)); ops.addOption(OptionBuilder.withDescription("specify the gene reference.").hasArg().create(cmd_hg)); ops.addOption(OptionBuilder.withDescription("use human genome build 18.").create(cmd_hg18)); ops.addOption(OptionBuilder.withDescription("use human genome build 19.").create(cmd_hg19)); ops.addOption(OptionBuilder.withDescription("specify the window size for a snp").hasArgs() .withLongOpt(cmd_snpwindow_long).create(cmd_snpwindow)); ops.addOption(OptionBuilder.withDescription("specify the background snp").hasArgs().create(cmd_bgsnp)); ops.addOption(OptionBuilder .withDescription("specify the file containing included snps when detecting interaction").hasArgs() .create(cmd_extract)); ops.addOption(OptionBuilder .withDescription("specify the file containing excluded snps when detecting interaction").hasArg() .create(cmd_exclude)); ops.addOption(OptionBuilder.withDescription("select chromosomes").hasArgs().create(cmd_chr)); ops.addOption(OptionBuilder.withDescription("specify interacting snps").create(cmd_trans)); ops.addOption(OptionBuilder.withDescription("remove individuals").hasArg().create(cmd_remove)); ops.addOption(OptionBuilder.withDescription("keep individuals").hasArg().create(cmd_keep)); // ops.addOption(OptionBuilder.withDescription("specify excluded individuals").hasArgs().create(cmd_ex_ind)); // ops.addOption(OptionBuilder.withDescription("specify the file containing excluded individual ids").hasArg().create(cmd_ex_ind_file)); ops.addOption(OptionBuilder.withDescription("keep males only").withLongOpt(cmd_keep_male_long) .create(cmd_keep_male)); ops.addOption(OptionBuilder.withDescription("keep females only").withLongOpt(cmd_keep_female_long) .create(cmd_keep_female)); ops.addOption(OptionBuilder.withDescription("exclude unknown sex").withLongOpt(cmd_ex_nosex_long) .create(cmd_ex_nosex)); ops.addOption(OptionBuilder.withDescription("specify phenotype by number.").hasArg() .withLongOpt(cmd_pheno_number_long).create(cmd_pheno_number)); // ops.addOption(OptionBuilder // .withDescription("specify phenotype by name.").hasArg() // .withLongOpt(cmd_pheno_name_long).create(cmd_pheno_name)); // ops.addOption(OptionBuilder // .withDescription( // "method for adjustment of the phenotype, 0 (default) for linear regression, 1 for logistic regression.") // .hasArg().create(cmd_reg)); ops.addOption(OptionBuilder.withDescription("fold of cross-validation, and default is 5.").hasArg() .create(cmd_cv)); // ops.addOption(OptionBuilder.withDescription("specify the proportion of the training set.").hasArg().create(cmd_trgroup)); // ops.addOption(OptionBuilder.withDescription("specify the file containing the training set.").hasArg().create(cmd_ttfile)); // ops.addOption(OptionBuilder.withDescription("specify the gender as the training set.").hasArg().create(cmd_trsex)); // ops.addOption(OptionBuilder.withDescription("specify start of the training set.").hasArgs().create(cmd_border)); ops.addOption( OptionBuilder.withDescription("specify the order of interaction.").hasArg().create(cmd_order)); ops.addOption( OptionBuilder.withDescription("specify the random sample fraction.").hasArg().create(cmd_thin)); ops.addOption(OptionBuilder.withDescription("specify partition of the searching space.").hasArg() .create(cmd_slice)); ops.addOption(OptionBuilder.withDescription("specify the minor allele frequency for inclusion.").hasArg() .create(cmd_maf)); ops.addOption(OptionBuilder.withDescription("specify the minor allele frequency for inclusion.").hasArg() .withLongOpt(cmd_max_maf_long).create(cmd_max_maf)); ops.addOption(OptionBuilder.withDescription("specify missing genotype rate for inclusion.").hasArg() .create(cmd_geno)); ops.addOption(OptionBuilder.withDescription("seed for the algorithms").hasArg().create(cmd_seed)); ops.addOption(OptionBuilder.withDescription("specify the classification for a tie genotype").hasArg() .create(cmd_tie)); ops.addOption(OptionBuilder.withDescription("replication for permutation.").hasArg().create(cmd_perm)); // ops.addOption(OptionBuilder.withDescription("only sibs are exchangeable when this option is turned on").create(cmd_perm_scheme)); // ops.addOption(OptionBuilder.withDescription("use unrelated indivuduals only, if '--md' is specified.").create(cmd_unrelated_only)); // ops.addOption(OptionBuilder.withDescription("replications for simulation, and this parameter is for simulation only").hasArg().create( // cmd_simu)); ops.addOption(OptionBuilder.withDescription("missing phenotype, default -9").hasArg() .withLongOpt(cmd_missing_phenotype_long).create(cmd_missing_phenotype)); // ops.addOption(OptionBuilder.withDescription("missing genotype, default 00").hasArg().create(cmd_missing_genotype)); ops.addOption(OptionBuilder.withDescription("missing allele, default 0").hasArg() .withLongOpt(cmd_missing_allele_long).create(cmd_missing_allele)); ops.addOption( OptionBuilder.withDescription("use this option if status was coded as 1 (unaffected)/2 (affected).") .create(cmd_status_shift)); /* ops.addOption(OptionBuilder .withDescription("output threshold for empirical p value.") .hasArg().create(cmd_ep)); ops.addOption(OptionBuilder .withDescription("threshold of variance explained for output") .hasArg().create(cmd_Vc)); ops.addOption(OptionBuilder .withDescription("threshold of training accuracy for output") .hasArg().create(cmd_training)); ops.addOption(OptionBuilder .withDescription("threshold of testing accuracy for output") .hasArg().create(cmd_testing)); */ ops.addOption(OptionBuilder.withDescription("specify the root for output files.").hasArg().create(cmd_out)); ops.addOption(OptionBuilder.withDescription("give an evaluation for computation time") .withLongOpt(cmd_testdrive_long).create(cmd_testdrive)); ops.addOption(OptionBuilder.withDescription("help manual.").create(cmd_help)); ops.addOption(OptionBuilder.withDescription("version.").create(cmd_version)); ops.addOption(OptionBuilder.withDescription("specify the number of nodes to use on a cluster.").hasArg() .create(cmd_node)); ops.addOption(OptionBuilder.withDescription("specify email to get informed.").hasArg().create(cmd_email)); ops.addOption(OptionBuilder.withDescription("specify memory size.").hasArg().create(cmd_memory)); ops.addOption( OptionBuilder.withDescription("specify wall time for each job.").hasArg().create(cmd_walltime)); ops.addOption(OptionBuilder.withDescription("submit jobs to a cluster.").create(cmd_submit)); }
From source file:com.cloudera.sqoop.tool.BaseSqoopTool.java
/** * @param explicitHiveImport true if the user has an explicit --hive-import * available, or false if this is implied by the tool. * @return options governing interaction with Hive *///from w ww . j a va 2 s . co m protected RelatedOptions getHiveOptions(boolean explicitHiveImport) { RelatedOptions hiveOpts = new RelatedOptions("Hive arguments"); if (explicitHiveImport) { hiveOpts.addOption(OptionBuilder .withDescription( "Import tables into Hive " + "(Uses Hive's default delimiters if none are set.)") .withLongOpt(HIVE_IMPORT_ARG).create()); } hiveOpts.addOption(OptionBuilder.withArgName("dir").hasArg().withDescription("Override $HIVE_HOME") .withLongOpt(HIVE_HOME_ARG).create()); hiveOpts.addOption(OptionBuilder.withDescription("Overwrite existing data in the Hive table") .withLongOpt(HIVE_OVERWRITE_ARG).create()); hiveOpts.addOption(OptionBuilder.withArgName("table-name").hasArg() .withDescription("Sets the table name to use when importing to hive").withLongOpt(HIVE_TABLE_ARG) .create()); return hiveOpts; }
From source file:mitm.common.tools.SendMail.java
@SuppressWarnings("static-access") private static Options createCommandLineOptions() { Options options = new Options(); Option hostOption = OptionBuilder.withArgName("host").hasArg().withDescription("smtp host").create("h"); hostOption.setRequired(false);/*from ww w .j a v a 2s. co m*/ options.addOption(hostOption); Option portOption = OptionBuilder.withArgName("port").hasArg().withDescription("smtp port").create("p"); portOption.setRequired(false); options.addOption(portOption); Option usernameOption = OptionBuilder.withArgName("username").hasArg().withDescription("username") .create("u"); usernameOption.setRequired(false); options.addOption(usernameOption); Option passwordPromptOption = OptionBuilder.withArgName("p").withDescription("ask for password") .create("pwd"); passwordPromptOption.setRequired(false); options.addOption(passwordPromptOption); Option passwordOption = OptionBuilder.withArgName("password").hasArg().withDescription("password") .create("password"); passwordOption.setRequired(false); options.addOption(passwordOption); Option senderOption = OptionBuilder.withArgName("sender").hasArg() .withDescription("enveloped sender (MAIL FROM)").create("s"); senderOption.setRequired(false); options.addOption(senderOption); Option subjectOption = OptionBuilder.withArgName("subject").hasArg().withDescription("subject") .create("su"); subjectOption.setRequired(false); options.addOption(subjectOption); Option fromOption = OptionBuilder.withArgName("from").hasArg().withDescription("from (header)").create("f"); fromOption.setRequired(false); options.addOption(fromOption); Option recipientsOption = OptionBuilder.withArgName("recipients").hasArg() .withDescription("comma separated recipients").create("r"); recipientsOption.setRequired(false); options.addOption(recipientsOption); Option inOption = OptionBuilder.withArgName("email file").hasArg().withDescription("input file (rfc 2822)") .create("in"); inOption.setRequired(false); options.addOption(inOption); Option countOption = OptionBuilder.withArgName("count").hasArg().withDescription("count").create("c"); countOption.setRequired(false); options.addOption(countOption); Option threadsOption = OptionBuilder.withArgName("threads").hasArg().withDescription("number of threads") .create("t"); threadsOption.setRequired(false); options.addOption(threadsOption); Option delayOption = OptionBuilder.withArgName("delay").hasArg().withDescription("delay in milliseconds") .create("d"); delayOption.setRequired(false); options.addOption(delayOption); Option listenOption = OptionBuilder.withArgName("listen").withDescription("listen for incoming SMTP") .create("l"); listenOption.setRequired(false); options.addOption(listenOption); Option throttlingOption = OptionBuilder.withArgName("throttling").hasArg().withDescription("throttle send") .create("throttle"); throttlingOption.setRequired(false); options.addOption(throttlingOption); Option serverPortOption = OptionBuilder.withArgName("port").hasArg().withDescription("smtp server port") .create("serverPort"); serverPortOption.setRequired(false); options.addOption(serverPortOption); Option uniqueFromOption = OptionBuilder.withDescription("prefix the from with an increasing counter") .create("uf"); uniqueFromOption.setRequired(false); options.addOption(uniqueFromOption); return options; }
From source file:daemon.dicomnode.DcmRcv.java
private static CommandLine parse(String[] args) { Options opts = new Options(); OptionBuilder.withArgName("name"); OptionBuilder.hasArg();/*www .j a va2 s.com*/ OptionBuilder.withDescription("set device name, use DCMRCV by default"); opts.addOption(OptionBuilder.create("device")); 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_2.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("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("dest")); OptionBuilder.withArgName("file|url"); OptionBuilder.hasArg(); OptionBuilder.withDescription("file path or URL of properties for mapping Calling AETs to " + "sub-directories of the storage directory specified by " + "-dest, to separate the storage location dependend on " + "Calling AETs."); opts.addOption(OptionBuilder.create("calling2dir")); OptionBuilder.withArgName("file|url"); OptionBuilder.hasArg(); OptionBuilder.withDescription("file path or URL of properties for mapping Called AETs to " + "sub-directories of the storage directory specified by " + "-dest, to separate the storage location dependend on " + "Called AETs."); opts.addOption(OptionBuilder.create("called2dir")); OptionBuilder.withArgName("sub-dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("storage sub-directory used for Calling AETs for which no " + " mapping is defined by properties specified by " + "-calling2dir, 'OTHER' by default."); opts.addOption(OptionBuilder.create("callingdefdir")); OptionBuilder.withArgName("sub-dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("storage sub-directory used for Called AETs for which no " + " mapping is defined by properties specified by " + "-called2dir, 'OTHER' by default."); opts.addOption(OptionBuilder.create("calleddefdir")); OptionBuilder.withArgName("dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("register stored objects in cache journal files in specified directory <dir>." + " Do not register stored objects by default."); opts.addOption(OptionBuilder.create("journal")); OptionBuilder.withArgName("pattern"); OptionBuilder.hasArg(); OptionBuilder.withDescription("cache journal file path, with " + "'yyyy' will be replaced by the current year, " + "'MM' by the current month, 'dd' by the current date, " + "'HH' by the current hour and 'mm' by the current minute. " + "'yyyy/MM/dd/HH/mm' by default."); opts.addOption(OptionBuilder.create("journalfilepath")); opts.addOption("defts", false, "accept only default transfer syntax."); opts.addOption("bigendian", false, "accept also Explict VR Big Endian transfer syntax."); opts.addOption("native", false, "accept only transfer syntax with uncompressed pixel data."); OptionGroup scRetrieveAET = new OptionGroup(); OptionBuilder.withArgName("aet"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Retrieve AE Title included in Storage Commitment " + "N-EVENT-REPORT in items of the Referenced SOP Sequence."); scRetrieveAET.addOption(OptionBuilder.create("scretraets")); OptionBuilder.withArgName("aet"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Retrieve AE Title included in Storage Commitment " + "N-EVENT-REPORT outside of the Referenced SOP Sequence."); scRetrieveAET.addOption(OptionBuilder.create("scretraet")); opts.addOptionGroup(scRetrieveAET); opts.addOption("screusefrom", false, "attempt to issue the Storage Commitment N-EVENT-REPORT on " + "the same Association on which the N-ACTION operation was " + "performed; use different Association for N-EVENT-REPORT by " + "default."); opts.addOption("screuseto", false, "attempt to issue the Storage Commitment N-EVENT-REPORT on " + "previous initiated Association to the Storage Commitment SCU; " + "initiate new Association for N-EVENT-REPORT by default."); OptionBuilder.withArgName("port"); OptionBuilder.hasArg(); OptionBuilder.withDescription("port of Storage Commitment SCU to connect to issue " + "N-EVENT-REPORT on different Association; 104 by default."); opts.addOption(OptionBuilder.create("scport")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder .withDescription("delay in ms for N-EVENT-REPORT-RQ to Storage Commitment SCU, " + "1s by default"); opts.addOption(OptionBuilder.create("scdelay")); OptionBuilder.withArgName("retry"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "number of retries to issue N-EVENT-REPORT-RQ to Storage " + "Commitment SCU, 0 by default"); opts.addOption(OptionBuilder.create("scretry")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("interval im ms between retries to issue N-EVENT-REPORT-RQ to" + "Storage Commitment SCU, 60s by default"); opts.addOption(OptionBuilder.create("scretryperiod")); OptionBuilder.withArgName("maxops"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "maximum number of outstanding operations performed " + "asynchronously, unlimited by default."); opts.addOption(OptionBuilder.create("async")); 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("timeout in ms for receiving DIMSE-RSP, 10s by default"); opts.addOption(OptionBuilder.create("rspTO")); 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("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("delay in ms for DIMSE-RSP; useful for testing asynchronous mode"); opts.addOption(OptionBuilder.create("rspdelay")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving -ASSOCIATE-RQ, 5s by default"); opts.addOption(OptionBuilder.create("requestTO")); 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("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 DIMSE-RQ, 60s by default"); opts.addOption(OptionBuilder.create("idleTO")); 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("bufsize")); 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("dcmrcv: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption("V")) { Package p = DcmRcv.class.getPackage(); System.out.println("dcmrcv v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption("h") || cl.getArgList().size() == 0) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:com.cloudera.sqoop.tool.ImportTool.java
/** * Construct the set of options that control imports, either of one * table or a batch of tables.//from www. j av a 2s. c o m * @return the RelatedOptions that can be used to parse the import * arguments. */ protected RelatedOptions getImportOptions() { // Imports RelatedOptions importOpts = new RelatedOptions("Import control arguments"); importOpts.addOption( OptionBuilder.withDescription("Use direct import fast path").withLongOpt(DIRECT_ARG).create()); if (!allTables) { importOpts.addOption(OptionBuilder.withArgName("table-name").hasArg().withDescription("Table to read") .withLongOpt(TABLE_ARG).create()); importOpts.addOption(OptionBuilder.withArgName("col,col,col...").hasArg() .withDescription("Columns to import from table").withLongOpt(COLUMNS_ARG).create()); importOpts.addOption(OptionBuilder.withArgName("column-name").hasArg() .withDescription("Column of the table used to split work units").withLongOpt(SPLIT_BY_ARG) .create()); importOpts.addOption(OptionBuilder.withArgName("where clause").hasArg() .withDescription("WHERE clause to use during import").withLongOpt(WHERE_ARG).create()); importOpts.addOption( OptionBuilder.withDescription("Imports data in append mode").withLongOpt(APPEND_ARG).create()); importOpts.addOption(OptionBuilder.withArgName("dir").hasArg() .withDescription("HDFS plain table destination").withLongOpt(TARGET_DIR_ARG).create()); importOpts.addOption(OptionBuilder.withArgName("statement").hasArg() .withDescription("Import results of SQL 'statement'").withLongOpt(SQL_QUERY_ARG) .create(SQL_QUERY_SHORT_ARG)); } importOpts.addOption(OptionBuilder.withArgName("dir").hasArg() .withDescription("HDFS parent for table destination").withLongOpt(WAREHOUSE_DIR_ARG).create()); importOpts.addOption(OptionBuilder.withDescription("Imports data to SequenceFiles") .withLongOpt(FMT_SEQUENCEFILE_ARG).create()); importOpts.addOption(OptionBuilder.withDescription("Imports data as plain text (default)") .withLongOpt(FMT_TEXTFILE_ARG).create()); importOpts.addOption( OptionBuilder.withArgName("n").hasArg().withDescription("Use 'n' map tasks to import in parallel") .withLongOpt(NUM_MAPPERS_ARG).create(NUM_MAPPERS_SHORT_ARG)); importOpts.addOption(OptionBuilder.withDescription("Enable compression").withLongOpt(COMPRESS_ARG) .create(COMPRESS_SHORT_ARG)); importOpts.addOption(OptionBuilder.withArgName("n").hasArg() .withDescription("Split the input stream every 'n' bytes " + "when importing in direct mode") .withLongOpt(DIRECT_SPLIT_SIZE_ARG).create()); importOpts.addOption( OptionBuilder.withArgName("n").hasArg().withDescription("Set the maximum size for an inline LOB") .withLongOpt(INLINE_LOB_LIMIT_ARG).create()); importOpts.addOption(OptionBuilder.withArgName("n").hasArg() .withDescription("Set number 'n' of rows to fetch from the " + "database when more rows are needed") .withLongOpt(FETCH_SIZE_ARG).create()); return importOpts; }
From source file:edu.hawaii.soest.kilonalu.utilities.FileArchiverSink.java
/** * This method overrides the setOptions() method in RBNBBase and adds in * options for the various command line flags. *///w w w.j av a 2s.c o m protected Options setOptions() { Options opt = setBaseOptions(new Options()); // uses h, s, p opt.addOption("k", true, "Sink Name (defaults to " + DEFAULT_SINK_NAME + ")"); opt.addOption("n", true, "Source Name (defaults to " + DEFAULT_SOURCE_NAME + ")"); opt.addOption("c", true, "Source Channel Name (defaults to " + DEFAULT_CHANNEL_NAME + ")"); opt.addOption("d", true, "Base directory path (defaults to " + DEFAULT_ARCHIVE_DIRECTORY + ")"); opt.addOption("S", true, "Start time (defauts to now)"); opt.addOption("E", true, "End time (defaults to forever)"); opt.addOption("I", true, "Interval (hourly, daily, or weekly) to periodically archive data\n Mututally exclusive with -E and -S"); opt.addOption(OptionBuilder.withDescription("Event markers to filter start/stop times").hasOptionalArg() .create("M")); opt.addOption("B", true, "Number of seconds to go back from now to set start time\n Mututally exclusive with -E and -S"); setNotes("Writes data frames between start time and end time to the " + "directory structure starting at the base directory. The time " + "format is yyyy-mm-dd:hhTmm:ss.nnn."); return opt; }
From source file:de.tudarmstadt.ukp.dariah.pipeline.RunPipeline.java
@SuppressWarnings("static-access") private static boolean parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption("help", false, "print this message"); Option lang = OptionBuilder.withArgName("lang").hasArg() .withDescription("Language code for input file (default: " + optLanguage + ")").create("language"); options.addOption(lang);/*from w w w . ja v a 2s . c o m*/ Option input = OptionBuilder.withArgName("path").hasArg().withDescription("Input path").create("input"); options.addOption(input); Option output = OptionBuilder.withArgName("path").hasArg().withDescription("Output path").create("output"); options.addOption(output); Option configFile = OptionBuilder.withArgName("path").hasArg().withDescription("Config file") .create("config"); options.addOption(configFile); Option reader = OptionBuilder.withArgName("reader").hasArg().withDescription("Either text (default) or xml") .create("reader"); options.addOption(reader); Option resume = OptionBuilder.withDescription("Already processed files will be skipped").create("resume"); options.addOption(resume); CommandLineParser argParser = new BasicParser(); CommandLine cmd = argParser.parse(options, args); if (cmd.hasOption("help")) { // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("pipeline.jar", options); return false; } if (cmd.hasOption(input.getOpt())) { optInput = cmd.getOptionValue(input.getOpt()); } else { System.out.println("Input option required"); return false; } if (cmd.hasOption(output.getOpt())) { optOutput = cmd.getOptionValue(output.getOpt()); } else { System.out.println("Output option required"); return false; } if (cmd.hasOption(lang.getOpt())) { optLanguage = cmd.getOptionValue(lang.getOpt()); } if (cmd.hasOption(reader.getOpt())) { String readerParam = cmd.getOptionValue(reader.getOpt()).toLowerCase(); if (readerParam.equals("text") || readerParam.equals("txt") || readerParam.equals("textreader") || readerParam.equals("txtreader")) { optReader = ReaderType.Text; } else if (readerParam.equals("xml") || readerParam.equals("xmlreader")) { optReader = ReaderType.XML; } else { System.out.println("The reader parameter is unknown: " + optReader); System.out.println("Valid argument values are: text, xml"); return false; } } if (cmd.hasOption(resume.getOpt())) { optResume = true; } return true; }
From source file:fr.iphc.grid.jobmanager.JobManager.java
private static OptionBuilder o(String description) { return OptionBuilder.withDescription(description); }
From source file:com.cloudera.sqoop.tool.BaseSqoopTool.java
/** * @return options governing output format delimiters *//*w w w . j a v a2s. c o m*/ protected RelatedOptions getOutputFormatOptions() { RelatedOptions formatOpts = new RelatedOptions("Output line formatting arguments"); formatOpts.addOption( OptionBuilder.withArgName("char").hasArg().withDescription("Sets the field separator character") .withLongOpt(FIELDS_TERMINATED_BY_ARG).create()); formatOpts.addOption(OptionBuilder.withArgName("char").hasArg() .withDescription("Sets the end-of-line character").withLongOpt(LINES_TERMINATED_BY_ARG).create()); formatOpts.addOption( OptionBuilder.withArgName("char").hasArg().withDescription("Sets a field enclosing character") .withLongOpt(OPTIONALLY_ENCLOSED_BY_ARG).create()); formatOpts.addOption(OptionBuilder.withArgName("char").hasArg() .withDescription("Sets a required field enclosing character").withLongOpt(ENCLOSED_BY_ARG) .create()); formatOpts.addOption(OptionBuilder.withArgName("char").hasArg().withDescription("Sets the escape character") .withLongOpt(ESCAPED_BY_ARG).create()); formatOpts.addOption(OptionBuilder .withDescription("Uses MySQL's default delimiter set: " + "fields: , lines: \\n escaped-by: \\ optionally-enclosed-by: '") .withLongOpt(MYSQL_DELIMITERS_ARG).create()); return formatOpts; }
From source file:ivory.app.PreprocessWikipedia.java
@SuppressWarnings("static-access") private int parseArgs(String[] args) { options = new Options(); options.addOption(OptionBuilder.withDescription("preprocessing mode") .withArgName("mono|crosslingF|crosslingE").hasArg().isRequired().create(MODE_OPTION)); options.addOption(OptionBuilder.withDescription("path to index directory").withArgName("path").hasArg() .isRequired().create(INDEX_PATH_OPTION)); options.addOption(OptionBuilder.withDescription("path to target index directory (if processing f-side)") .withArgName("path").hasArg().create(TARGET_INDEX_PATH_OPTION)); options.addOption(OptionBuilder.withDescription("path to XML file").withArgName("path").hasArg() .isRequired().create(XML_PATH_OPTION)); options.addOption(OptionBuilder.withDescription("path to compressed collection").withArgName("path") .hasArg().isRequired().create(COMPRESSED_PATH_OPTION)); options.addOption(OptionBuilder.withDescription("tokenizer class").withArgName("class").hasArg() .create(TOKENIZER_CLASS_OPTION)); options.addOption(OptionBuilder.withDescription("path to tokenizer model file/directory") .withArgName("path").hasArg().create(TOKENIZER_MODEL_OPTION)); options.addOption(OptionBuilder.withDescription("path to target-side tokenizer model file/directory") .withArgName("path").hasArg().create(E_TOKENIZER_MODEL_OPTION)); options.addOption(OptionBuilder.withDescription("path to collection vocab file").withArgName("path") .hasArg().create(COLLECTION_VOCAB_OPTION)); options.addOption(OptionBuilder.withDescription("two-letter collection language code") .withArgName("en|de|fr|zh|es|ar|tr").hasArg().isRequired().create(LANGUAGE_OPTION)); options.addOption(OptionBuilder.withDescription("two-letter target language code") .withArgName("en|de|fr|zh|es|ar|tr").hasArg().create(E_LANGUAGE_OPTION)); options.addOption(OptionBuilder.withDescription("path to f-side stopwords list").withArgName("path") .hasArg().create(F_STOPWORD_OPTION)); options.addOption(OptionBuilder.withDescription("path to e-side stopwords list").withArgName("path") .hasArg().create(E_STOPWORD_OPTION)); options.addOption(OptionBuilder.withDescription("path to f-side vocab file of f-to-e translation table") .withArgName("path").hasArg().create(FVOCAB_F2E_OPTION)); options.addOption(OptionBuilder.withDescription("path to e-side vocab file of f-to-e translation table") .withArgName("path").hasArg().create(EVOCAB_F2E_OPTION)); options.addOption(OptionBuilder.withDescription("path to f-side vocab file of e-to-f translation table") .withArgName("path").hasArg().create(FVOCAB_E2F_OPTION)); options.addOption(OptionBuilder.withDescription("path to e-side vocab file of e-to-f translation table") .withArgName("path").hasArg().create(EVOCAB_E2F_OPTION)); options.addOption(OptionBuilder.withDescription("path to f-to-e translation table").withArgName("path") .hasArg().create(TTABLE_F2E_OPTION)); options.addOption(OptionBuilder.withDescription("path to e-to-f translation table").withArgName("path") .hasArg().create(TTABLE_E2F_OPTION)); options.addOption(OptionBuilder.withDescription("Hadoop option to load external jars") .withArgName("jar packages").hasArg().create(LIBJARS_OPTION)); CommandLine cmdline;//from w w w. ja v a 2 s . com CommandLineParser parser = new GnuParser(); try { cmdline = parser.parse(options, args); } catch (ParseException exp) { System.err.println("Error parsing command line: " + exp.getMessage()); return -1; } String m = cmdline.getOptionValue(MODE_OPTION); mode = m.equals("mono") ? MONO_LINGUAL : (m.equals("crosslingF") ? CROSS_LINGUAL_F : (m.equals("crosslingE")) ? CROSS_LINGUAL_E : -1); if (mode < 0) throw new RuntimeException("Incorrect mode selection!"); if (mode == CROSS_LINGUAL_F) { if (!options.hasOption(FVOCAB_F2E_OPTION) || !options.hasOption(FVOCAB_E2F_OPTION) || !options.hasOption(EVOCAB_F2E_OPTION) || !options.hasOption(EVOCAB_E2F_OPTION) || !options.hasOption(TTABLE_F2E_OPTION) || !options.hasOption(TTABLE_E2F_OPTION) || !options.hasOption(E_LANGUAGE_OPTION)) { System.err.println( "Error, missing translation table arguments: " + FVOCAB_F2E_OPTION + "," + EVOCAB_F2E_OPTION + "," + FVOCAB_E2F_OPTION + "," + EVOCAB_E2F_OPTION + "," + TTABLE_F2E_OPTION + "," + TTABLE_E2F_OPTION + "," + E_TOKENIZER_MODEL_OPTION + "," + E_LANGUAGE_OPTION); return -1; } } if (mode == CROSS_LINGUAL_E) { if (!options.hasOption(COLLECTION_VOCAB_OPTION)) { System.err.println("Error, missing collection vocab argument: " + COLLECTION_VOCAB_OPTION); return -1; } if (options.hasOption(FVOCAB_F2E_OPTION) || options.hasOption(FVOCAB_E2F_OPTION) || options.hasOption(EVOCAB_F2E_OPTION) || options.hasOption(EVOCAB_E2F_OPTION) || options.hasOption(TTABLE_F2E_OPTION) || options.hasOption(TTABLE_E2F_OPTION)) { System.err.println("Warning, translation table arguments are ignored in this mode!"); } } indexRootPath = cmdline.getOptionValue(INDEX_PATH_OPTION); targetIndexPath = cmdline.getOptionValue(TARGET_INDEX_PATH_OPTION); rawCollection = cmdline.getOptionValue(XML_PATH_OPTION); seqCollection = cmdline.getOptionValue(COMPRESSED_PATH_OPTION); tokenizerClass = cmdline.getOptionValue(TOKENIZER_CLASS_OPTION); tokenizerModel = cmdline.getOptionValue(TOKENIZER_MODEL_OPTION); collectionVocab = cmdline.getOptionValue(COLLECTION_VOCAB_OPTION); collectionLang = cmdline.getOptionValue(LANGUAGE_OPTION); f_stopwordList = cmdline.getOptionValue(F_STOPWORD_OPTION); e_stopwordList = cmdline.getOptionValue(E_STOPWORD_OPTION); fVocab_f2e = cmdline.getOptionValue(FVOCAB_F2E_OPTION); eVocab_f2e = cmdline.getOptionValue(EVOCAB_F2E_OPTION); fVocab_e2f = cmdline.getOptionValue(FVOCAB_E2F_OPTION); eVocab_e2f = cmdline.getOptionValue(EVOCAB_E2F_OPTION); ttable_f2e = cmdline.getOptionValue(TTABLE_F2E_OPTION); ttable_e2f = cmdline.getOptionValue(TTABLE_E2F_OPTION); e_tokenizerModel = cmdline.getOptionValue(E_TOKENIZER_MODEL_OPTION); targetLang = cmdline.getOptionValue(E_LANGUAGE_OPTION); return 1; }