List of usage examples for org.apache.commons.cli OptionBuilder withLongOpt
public static OptionBuilder withLongOpt(String newLongopt)
From source file:edu.buffalo.fusim.Fusim.java
@SuppressWarnings("static-access") private void buildOptions() { options = new Options(); options.addOption(OptionBuilder.withLongOpt("help").withDescription("print usage info").create("h")); options.addOption(OptionBuilder.withLongOpt("gene-model") .withDescription("Path to gene model file in refFlat format").hasArg().create("g")); options.addOption(OptionBuilder.withLongOpt("reference") .withDescription("Path to indexed reference genome fasta file (.fai)").hasArg().create("r")); options.addOption(OptionBuilder.withLongOpt("background-reads").withDescription( "Path to BAM file containing background reads. Genes will be selected for fusions according to the read profile of the background reads.") .hasArg().create("b")); options.addOption(OptionBuilder.withLongOpt("fusions") .withDescription("Number of fusions to generate using two randomly selected genes").hasArg() .create("n")); options.addOption(OptionBuilder.withLongOpt("text-output").withDescription("File name of text output") .hasArg().create("t")); options.addOption(OptionBuilder.withLongOpt("fasta-output").withDescription("File name of FASTA output") .hasArg().create("f")); options.addOption(// www . j a va 2 s . c o m OptionBuilder.withLongOpt("cds-only").withDescription("Only include CDS exons").create("c")); options.addOption(OptionBuilder.withLongOpt("read-through") .withDescription("Number of read through fusions").hasArg().create("x")); options.addOption(OptionBuilder.withLongOpt("tri-fusion") .withDescription("Number of fusions with three genes").hasArg().create("j")); options.addOption(OptionBuilder.withLongOpt("self-fusion") .withDescription("Number of self-fusions (fusions with single gene)").hasArg().create("s")); options.addOption(OptionBuilder.withLongOpt("intra-chrom") .withDescription("Number of intra-chromosome fusions (fusions within single chrom)").hasArg() .create("y")); options.addOption(OptionBuilder.withLongOpt("rpkm-cutoff") .withDescription( "RPKM cutoff when using background BAM file. Genes below the cutoff will be ignored") .hasArg().create("k")); options.addOption(OptionBuilder.withLongOpt("threads") .withDescription("Number of threads to spawn when processing background BAM file").hasArg() .create("p")); options.addOption(OptionBuilder.withLongOpt("convert") .withDescription("Convert GTF/GFF to refFlat (genePred) format").create("z")); options.addOption(OptionBuilder.withLongOpt("gtf").withDescription("Input GTF file for conversion").hasArg() .create("i")); options.addOption(OptionBuilder.withLongOpt("output").withDescription("Output refFlat file for conversion") .hasArg().create("o")); options.addOption(OptionBuilder.withLongOpt("gene-selection-method").withDescription( "Method to use when selecting genes for fusions: uniform|binned|empirical|empirical-sturges") .hasArg().create("m")); options.addOption(OptionBuilder.withLongOpt("auto-correct-orientation") .withDescription( "Auto correct orientation of fusion sequence if genes are located on different strands") .create("a")); options.addOption(OptionBuilder.withLongOpt("out-of-frame") .withDescription( "Allow fusions outside of reading frames. By default the reading frame is preserved") .create("d")); options.addOption(OptionBuilder.withLongOpt("keep-exon-boundary") .withDescription("Generate fusion breaks on exon boundaries only").create("e")); options.addOption(OptionBuilder.withLongOpt("limit") .withDescription("Limit all fusions to specific geneId, transcriptId, or chrom").hasArg() .create("l")); options.addOption( OptionBuilder.withLongOpt("gene1").withDescription("Filter for gene1").hasArg().create("1")); options.addOption( OptionBuilder.withLongOpt("gene2").withDescription("Filter for gene2").hasArg().create("2")); options.addOption( OptionBuilder.withLongOpt("gene3").withDescription("Filter for gene3").hasArg().create("3")); options.addOption(OptionBuilder.withLongOpt("foreign-insertion-length") .withDescription( "Maxium length of randomly generated sequence to insert between fusion breakpoints") .hasArg().create("u")); options.addOption(OptionBuilder.withLongOpt("foreign-insertion-perecent") .withDescription("Percent of fusions to insert foreign sequence between fusion breakpoints") .hasArg().create("w")); options.addOption(OptionBuilder.withLongOpt("version").withDescription("Display version info").create("v")); }
From source file:com.aliyun.odps.ship.common.OptionsBuilder.java
public static Options getUploadOptions() { Options opts = getGlobalOptions();//from ww w. j ava 2s .co m opts.addOption(OptionBuilder.withLongOpt(Constants.DISCARD_BAD_RECORDS).withDescription( "specify discard bad records action(true|false), default " + Constants.DEFAULT_DISCARD_BAD_RECORDS) .hasArg().withArgName("ARG").create("dbr")); opts.addOption(OptionBuilder.withLongOpt(Constants.SCAN) .withDescription("specify scan file action(true|false|only), default " + Constants.DEFAULT_SCAN) .hasArg().withArgName("ARG").create("s")); opts.addOption(OptionBuilder.withLongOpt(Constants.BLOCK_SIZE) .withDescription("block size in MiB, default " + Constants.DEFAULT_BLOCK_SIZE).hasArg() .withArgName("ARG").create("bs")); opts.addOption(OptionBuilder.withLongOpt(Constants.MAX_BAD_RECORDS) .withDescription("max bad records, default " + Constants.DEFAULT_BAD_RECORDS).hasArg() .withArgName("ARG").create("mbr")); return opts; }
From source file:mod.org.dcm4che2.tool.DcmSnd.java
private static CommandLine parse(String[] args) { Options opts = new Options(); OptionBuilder.withArgName("name"); OptionBuilder.hasArg();//from w w w. j av a2s. co m OptionBuilder.withDescription("set device name, use DCMSND 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")); opts.addOption("ts1", false, "offer Default Transfer Syntax in " + "separate Presentation Context. By default offered with " + "Explicit VR Little Endian TS in one PC."); opts.addOption("fileref", false, "send objects without pixel data, but with a reference to " + "the DICOM file using DCM4CHE URI Referenced Transfer Syntax " + "to import DICOM objects on a given file system to a DCM4CHEE " + "archive."); 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_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("aet@host:port"); OptionBuilder.hasArg(); OptionBuilder.withDescription("request storage commitment of (successfully) sent objects " + "afterwards in new association to specified remote " + "Application Entity"); opts.addOption(OptionBuilder.create("stgcmtae")); opts.addOption("stgcmt", false, "request storage commitment of (successfully) sent objects " + "afterwards in same association"); OptionBuilder.withArgName("attr=value"); OptionBuilder.hasArgs(); OptionBuilder.withValueSeparator('='); OptionBuilder.withDescription("Replace value of specified attribute " + "with specified value in transmitted objects. attr can be " + "specified by name or tag value (in hex), e.g. PatientName " + "or 00100010."); opts.addOption(OptionBuilder.create("set")); OptionBuilder.withArgName("salt"); OptionBuilder.hasArgs(); OptionBuilder.withDescription( "Anonymize the files. Set to 0 for a random anonymization (not repeatable) or 1 for a daily anonymization or another" + " value for a specific salt for reproducible anonymization (useful for allowing studies to be sent at a later date and still correctly named/associated)"); OptionBuilder.withLongOpt("anonymize"); opts.addOption(OptionBuilder.create("a")); OptionBuilder.withArgName("sx1[:sx2[:sx3]"); OptionBuilder.hasArgs(); OptionBuilder.withValueSeparator(':'); OptionBuilder.withDescription( "Suffix SOP [,Series [,Study]] " + "Instance UID with specified value[s] in transmitted objects."); opts.addOption(OptionBuilder.create("setuid")); OptionBuilder.withArgName("maxops"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximum number of outstanding operations it may invoke " + "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("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 closing the listening socket, " + "1000ms by default"); opts.addOption(OptionBuilder.create("shutdowndelay")); 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-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("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("transcoder buffer size in KB, 1KB by default"); opts.addOption(OptionBuilder.create("bufsize")); OptionBuilder.withArgName("count"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Batch size - Number of files to be sent in each batch, " + "where a storage commit is done between batches "); opts.addOption(OptionBuilder.create("batchsize")); opts.addOption("lowprior", false, "LOW priority of the C-STORE operation, MEDIUM by default"); opts.addOption("highprior", false, "HIGH priority of the C-STORE operation, MEDIUM by default"); 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("dcmsnd: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption('V')) { Package p = DcmSnd.class.getPackage(); System.out.println("dcmsnd v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption('h') || cl.getArgList().size() < 2) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:com.facebook.presto.accumulo.tools.RewriteIndex.java
@SuppressWarnings("static-access") @Override/*from ww w . ja v a2s.c o m*/ public Options getOptions() { Options opts = new Options(); opts.addOption(OptionBuilder.withLongOpt("authorizations").withDescription( "List of scan authorizations. Default is to get user authorizations for the user in the configuration.") .hasArgs().create(AUTHORIZATIONS_OPT)); opts.addOption(OptionBuilder.withLongOpt("schema").withDescription("Presto schema name").hasArg() .isRequired().create(SCHEMA_OPT)); opts.addOption(OptionBuilder.withLongOpt("table").withDescription("Presto table name").hasArg().isRequired() .create(TABLE_OPT)); opts.addOption(OptionBuilder.withLongOpt(FORCE_OPT) .withDescription("Force deleting of entries. Default is a dry run").create()); opts.addOption(OptionBuilder.withLongOpt(ADD_ONLY_OPT).withDescription( "Only add index entries, do not delete them or run the rewrite metrics tool. Requires --force to do anything. Default is to add and delete.") .create()); return opts; }
From source file:net.sf.freecol.FreeCol.java
/** * Processes the command-line arguments and takes appropriate * actions for each of them./*w w w. j ava 2 s. c om*/ * * @param args The command-line arguments. */ private static void handleArgs(String[] args) { Options options = new Options(); final String help = Messages.message("cli.help"); final File dummy = new File("dummy"); final String argDirectory = Messages.message("cli.arg.directory"); // Help options. options.addOption(OptionBuilder.withLongOpt("usage").withDescription(help).create()); options.addOption(OptionBuilder.withLongOpt("help").withDescription(help).create()); // Special options handled early. options.addOption(OptionBuilder.withLongOpt("freecol-data") .withDescription(Messages.message("cli.freecol-data")).withArgName(argDirectory).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("default-locale").withDescription(Messages.message("cli.default-locale")) .withArgName(Messages.message("cli.arg.locale")).hasArg().create()); // Ordinary options, handled here. options.addOption(OptionBuilder.withLongOpt("advantages") .withDescription(Messages.message( StringTemplate.template("cli.advantages").addName("%advantages%", getValidAdvantages()))) .withArgName(Messages.message("cli.arg.advantages")).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("check-savegame").withDescription(Messages.message("cli.check-savegame")) .withArgName(Messages.message("cli.arg.file")).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("clientOptions").withDescription(Messages.message("cli.clientOptions")) .withArgName(Messages.message("cli.arg.clientOptions")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("debug") .withDescription(Messages.message( StringTemplate.template("cli.debug").addName("%modes%", FreeColDebugger.getDebugModes()))) .withArgName(Messages.message("cli.arg.debug")).hasOptionalArg().create()); options.addOption(OptionBuilder.withLongOpt("debug-run").withDescription(Messages.message("cli.debug-run")) .withArgName(Messages.message("cli.arg.debugRun")).hasOptionalArg().create()); options.addOption(OptionBuilder.withLongOpt("debug-start") .withDescription(Messages.message("cli.debug-start")).create()); options.addOption( OptionBuilder.withLongOpt("difficulty").withDescription(Messages.message("cli.difficulty")) .withArgName(Messages.message("cli.arg.difficulty")).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("europeans").withDescription(Messages.message("cli.european-count")) .withArgName(Messages.message("cli.arg.europeans")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("fast").withDescription(Messages.message("cli.fast")).create()); options.addOption(OptionBuilder.withLongOpt("font").withDescription(Messages.message("cli.font")) .withArgName(Messages.message("cli.arg.font")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("full-screen") .withDescription(Messages.message("cli.full-screen")).create()); options.addOption(OptionBuilder.withLongOpt("gui-scale") .withDescription(Messages .message(StringTemplate.template("cli.gui-scale").addName("%scales%", getValidGUIScales()))) .withArgName(Messages.message("cli.arg.gui-scale")).hasOptionalArg().create()); options.addOption( OptionBuilder.withLongOpt("headless").withDescription(Messages.message("cli.headless")).create()); options.addOption( OptionBuilder.withLongOpt("load-savegame").withDescription(Messages.message("cli.load-savegame")) .withArgName(Messages.message("cli.arg.file")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("log-console") .withDescription(Messages.message("cli.log-console")).create()); options.addOption(OptionBuilder.withLongOpt("log-file").withDescription(Messages.message("cli.log-file")) .withArgName(Messages.message("cli.arg.name")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("log-level").withDescription(Messages.message("cli.log-level")) .withArgName(Messages.message("cli.arg.loglevel")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("name").withDescription(Messages.message("cli.name")) .withArgName(Messages.message("cli.arg.name")).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("no-intro").withDescription(Messages.message("cli.no-intro")).create()); options.addOption(OptionBuilder.withLongOpt("no-java-check") .withDescription(Messages.message("cli.no-java-check")).create()); options.addOption(OptionBuilder.withLongOpt("no-memory-check") .withDescription(Messages.message("cli.no-memory-check")).create()); options.addOption( OptionBuilder.withLongOpt("no-sound").withDescription(Messages.message("cli.no-sound")).create()); options.addOption( OptionBuilder.withLongOpt("no-splash").withDescription(Messages.message("cli.no-splash")).create()); options.addOption( OptionBuilder.withLongOpt("private").withDescription(Messages.message("cli.private")).create()); options.addOption(OptionBuilder.withLongOpt("seed").withDescription(Messages.message("cli.seed")) .withArgName(Messages.message("cli.arg.seed")).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("server").withDescription(Messages.message("cli.server")).create()); options.addOption( OptionBuilder.withLongOpt("server-name").withDescription(Messages.message("cli.server-name")) .withArgName(Messages.message("cli.arg.name")).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("server-port").withDescription(Messages.message("cli.server-port")) .withArgName(Messages.message("cli.arg.port")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("splash").withDescription(Messages.message("cli.splash")) .withArgName(Messages.message("cli.arg.file")).hasOptionalArg().create()); options.addOption(OptionBuilder.withLongOpt("tc").withDescription(Messages.message("cli.tc")) .withArgName(Messages.message("cli.arg.name")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("timeout").withDescription(Messages.message("cli.timeout")) .withArgName(Messages.message("cli.arg.timeout")).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("user-cache-directory") .withDescription(Messages.message("cli.user-cache-directory")).withArgName(argDirectory) .withType(dummy).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("user-config-directory") .withDescription(Messages.message("cli.user-config-directory")).withArgName(argDirectory) .withType(dummy).hasArg().create()); options.addOption(OptionBuilder.withLongOpt("user-data-directory") .withDescription(Messages.message("cli.user-data-directory")).withArgName(argDirectory) .withType(dummy).hasArg().create()); options.addOption( OptionBuilder.withLongOpt("version").withDescription(Messages.message("cli.version")).create()); options.addOption(OptionBuilder.withLongOpt("windowed").withDescription(Messages.message("cli.windowed")) .withArgName(Messages.message("cli.arg.dimensions")).hasOptionalArg().create()); CommandLineParser parser = new PosixParser(); boolean usageError = false; try { CommandLine line = parser.parse(options, args); if (line.hasOption("help") || line.hasOption("usage")) { printUsage(options, 0); } if (line.hasOption("default-locale")) { ; // Do nothing, already handled in main(). } if (line.hasOption("freecol-data")) { ; // Do nothing, already handled in main(). } if (line.hasOption("advantages")) { String arg = line.getOptionValue("advantages"); Advantages a = selectAdvantages(arg); if (a == null) { fatal(StringTemplate.template("cli.error.advantages") .addName("%advantages%", getValidAdvantages()).addName("%arg%", arg)); } } if (line.hasOption("check-savegame")) { String arg = line.getOptionValue("check-savegame"); if (!FreeColDirectories.setSavegameFile(arg)) { fatal(StringTemplate.template("cli.err.save").addName("%string%", arg)); } checkIntegrity = true; standAloneServer = true; } if (line.hasOption("clientOptions")) { String fileName = line.getOptionValue("clientOptions"); if (!FreeColDirectories.setClientOptionsFile(fileName)) { // Not fatal. gripe(StringTemplate.template("cli.error.clientOptions").addName("%string%", fileName)); } } if (line.hasOption("debug")) { // If the optional argument is supplied use limited mode. String arg = line.getOptionValue("debug"); if (arg == null || arg.isEmpty()) { // Let empty argument default to menus functionality. arg = FreeColDebugger.DebugMode.MENUS.toString(); } if (!FreeColDebugger.setDebugModes(arg)) { // Not fatal. gripe(StringTemplate.template("cli.error.debug").addName("%modes%", FreeColDebugger.getDebugModes())); } // user set log level has precedence if (!line.hasOption("log-level")) logLevel = Level.FINEST; } if (line.hasOption("debug-run")) { FreeColDebugger.enableDebugMode(FreeColDebugger.DebugMode.MENUS); FreeColDebugger.configureDebugRun(line.getOptionValue("debug-run")); } if (line.hasOption("debug-start")) { debugStart = true; FreeColDebugger.enableDebugMode(FreeColDebugger.DebugMode.MENUS); } if (line.hasOption("difficulty")) { String arg = line.getOptionValue("difficulty"); String difficulty = selectDifficulty(arg); if (difficulty == null) { fatal(StringTemplate.template("cli.error.difficulties") .addName("%difficulties%", getValidDifficulties()).addName("%arg%", arg)); } } if (line.hasOption("europeans")) { int e = selectEuropeanCount(line.getOptionValue("europeans")); if (e < 0) { gripe(StringTemplate.template("cli.error.europeans").addAmount("%min%", EUROPEANS_MIN)); } } if (line.hasOption("fast")) { fastStart = true; introVideo = false; } if (line.hasOption("font")) { fontName = line.getOptionValue("font"); } if (line.hasOption("full-screen")) { windowSize = null; } if (line.hasOption("gui-scale")) { String arg = line.getOptionValue("gui-scale"); if (!setGUIScale(arg)) { gripe(StringTemplate.template("cli.error.gui-scale").addName("%scales%", getValidGUIScales()) .addName("%arg%", arg)); } } if (line.hasOption("headless")) { headless = true; } if (line.hasOption("load-savegame")) { String arg = line.getOptionValue("load-savegame"); if (!FreeColDirectories.setSavegameFile(arg)) { fatal(StringTemplate.template("cli.error.save").addName("%string%", arg)); } } if (line.hasOption("log-console")) { consoleLogging = true; } if (line.hasOption("log-file")) { FreeColDirectories.setLogFilePath(line.getOptionValue("log-file")); } if (line.hasOption("log-level")) { setLogLevel(line.getOptionValue("log-level")); } if (line.hasOption("name")) { setName(line.getOptionValue("name")); } if (line.hasOption("no-intro")) { introVideo = false; } if (line.hasOption("no-java-check")) { javaCheck = false; } if (line.hasOption("no-memory-check")) { memoryCheck = false; } if (line.hasOption("no-sound")) { sound = false; } if (line.hasOption("no-splash")) { splashStream = null; } if (line.hasOption("private")) { publicServer = false; } if (line.hasOption("server")) { standAloneServer = true; } if (line.hasOption("server-name")) { serverName = line.getOptionValue("server-name"); } if (line.hasOption("server-port")) { String arg = line.getOptionValue("server-port"); if (!setServerPort(arg)) { fatal(StringTemplate.template("cli.error.serverPort").addName("%string%", arg)); } } if (line.hasOption("seed")) { FreeColSeed.setFreeColSeed(line.getOptionValue("seed")); } if (line.hasOption("splash")) { String splash = line.getOptionValue("splash"); try { FileInputStream fis = new FileInputStream(splash); splashStream = fis; } catch (FileNotFoundException fnfe) { gripe(StringTemplate.template("cli.error.splash").addName("%name%", splash)); } } if (line.hasOption("tc")) { setTC(line.getOptionValue("tc")); // Failure is deferred. } if (line.hasOption("timeout")) { String arg = line.getOptionValue("timeout"); if (!setTimeout(arg)) { // Not fatal gripe(StringTemplate.template("cli.error.timeout").addName("%string%", arg).addName("%minimum%", Integer.toString(TIMEOUT_MIN))); } } if (line.hasOption("user-cache-directory")) { String arg = line.getOptionValue("user-cache-directory"); String errMsg = FreeColDirectories.setUserCacheDirectory(arg); if (errMsg != null) { // Not fatal. gripe(StringTemplate.template(errMsg).addName("%string%", arg)); } } if (line.hasOption("user-config-directory")) { String arg = line.getOptionValue("user-config-directory"); String errMsg = FreeColDirectories.setUserConfigDirectory(arg); if (errMsg != null) { // Not fatal. gripe(StringTemplate.template(errMsg).addName("%string%", arg)); } } if (line.hasOption("user-data-directory")) { String arg = line.getOptionValue("user-data-directory"); String errMsg = FreeColDirectories.setUserDataDirectory(arg); if (errMsg != null) { // Fatal, unable to save. fatal(StringTemplate.template(errMsg).addName("%string%", arg)); } } if (line.hasOption("version")) { System.out.println("FreeCol " + getVersion()); System.exit(0); } if (line.hasOption("windowed")) { String arg = line.getOptionValue("windowed"); setWindowSize(arg); // Does not fail } } catch (ParseException e) { System.err.println("\n" + e.getMessage() + "\n"); usageError = true; } if (usageError) printUsage(options, 1); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.sensitivity.SobolAnalysis.java
@SuppressWarnings("static-access") @Override//from www . j ava 2 s . c o m public Options getOptions() { Options options = super.getOptions(); options.addOption( OptionBuilder.withLongOpt("parameterFile").hasArg().withArgName("file").isRequired().create('p')); options.addOption(OptionBuilder.withLongOpt("input").hasArg().withArgName("file").isRequired().create('i')); options.addOption( OptionBuilder.withLongOpt("metric").hasArg().withArgName("value").isRequired().create('m')); options.addOption(OptionBuilder.withLongOpt("simple").create('s')); options.addOption(OptionBuilder.withLongOpt("output").hasArg().withArgName("file").create('o')); options.addOption(OptionBuilder.withLongOpt("resamples").hasArg().withArgName("number").create('r')); return options; }
From source file:com.facebook.presto.accumulo.tools.RewriteMetricsTask.java
@SuppressWarnings("static-access") @Override//from w w w . j a v a 2 s .c o m public Options getOptions() { Options opts = new Options(); opts.addOption(OptionBuilder.withLongOpt("authorizations").withDescription( "List of scan authorizations. Default is to get user authorizations for the user in the configuration.") .hasArgs().create(AUTHORIZATIONS_OPT)); opts.addOption(OptionBuilder.withLongOpt("schema").withDescription("Presto schema name").hasArg() .isRequired().create(SCHEMA_OPT)); opts.addOption(OptionBuilder.withLongOpt("table").withDescription("Presto table name").hasArg().isRequired() .create(TABLE_OPT)); opts.addOption(OptionBuilder.withLongOpt(FORCE_OPT) .withDescription("Force deleting of entries. Default is a dry run").create()); return opts; }
From source file:com.aliyun.odps.ship.common.OptionsBuilder.java
public static Options getDownloadOptions() { Options opts = getGlobalOptions();/* w ww . j a va 2 s . com*/ opts.addOption(OptionBuilder.withLongOpt(Constants.LIMIT) .withDescription("specify the number of records to download").hasArg().withArgName("ARG").create()); return opts; }
From source file:com.aliyun.odps.ship.common.OptionsBuilder.java
public static Options getResumeOptions() { Options opts = getGlobalOptions();//from w w w. jav a2s. c om opts.addOption(OptionBuilder.withLongOpt("force").withDescription("force resume").create("f")); return opts; }
From source file:com.aliyun.odps.ship.common.OptionsBuilder.java
public static Options getShowOptions() { Options opts = getGlobalOptions();/*from w ww. j a v a 2 s. co m*/ opts.addOption(OptionBuilder.withLongOpt("number").withDescription("lines").hasArg().withArgName("ARG") .create("n")); return opts; }