List of usage examples for org.apache.commons.cli OptionBuilder withLongOpt
public static OptionBuilder withLongOpt(String newLongopt)
From source file:it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarks.java
@SuppressWarnings("static-access") private Options createOptions() { Options appOptions = new Options(); appOptions.addOption("f", "force", false, Res.getString("FORCE_DESCR")); appOptions.addOption("v", "version", false, Res.getString("VERSION_DESCR")); appOptions.addOption("h", "help", false, Res.getString("HELP_DESCR")); appOptions.addOption(// w w w .ja v a 2s. com OptionBuilder.withLongOpt("dump").withDescription(Res.getString("DUMP_DESCR")).create('d')); appOptions.addOption(OptionBuilder.withLongOpt("apply").hasArg(true).withArgName("bookmarks.txt") .withDescription(Res.getString("APPLY_DESCR")).create('a')); appOptions.addOption(OptionBuilder.withLongOpt("out").hasArg(true).withArgName("output.pdf") .withDescription(Res.getString("OUT_DESCR")).create('o')); appOptions.addOption(OptionBuilder.withLongOpt("encoding").hasArg(true).withArgName("UTF-8") .withDescription(Res.getString("ENCODING_DESCR")).create('e')); appOptions.addOption("b", "bookmark", true, Res.getString("BOOKMARK_ARG_DESCR")); appOptions.addOption("p", "page-sep", true, Res.getString("PAGE_SEP_DESCR")); appOptions.addOption("t", "attributes-sep", true, Res.getString("ATTRIBUTES_SEP_DESCR")); appOptions.addOption("i", "indentation", true, Res.getString("INDENTATION_STRING_DESCR")); appOptions.addOption("w", "show-on-open", true, Res.getString("SHOW_ON_OPEN_DESCR")); return appOptions; }
From source file:com.bericotech.clavin.index.IndexDirectoryBuilder.java
private static Options getOptions() { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt(HELP_OPTION).withDescription("Print help").create('?')); options.addOption(OptionBuilder.withLongOpt(FULL_ANCESTRY_OPTION) .withDescription("Store the gazetteer records for the full ancestry tree of each element." + " This will increase performance at the expense of a larger index.") .create());/*from ww w .j av a 2 s . c o m*/ options.addOption( OptionBuilder.withLongOpt(GAZETTEER_FILES_OPTION) .withDescription(String.format( "The ':'-separated list of input Gazetteer files to parse. Default: %s", StringUtils.join(DEFAULT_GAZETTEER_FILES, ':'))) .hasArgs().withValueSeparator(':').create('i')); options.addOption(OptionBuilder.withLongOpt(ALTERNATE_NAMES_OPTION).withDescription( "When provided, the path to the GeoNames.org alternate names file for resolution of common and " + "short names for each location. If not provided, the default name for each location will be used.") .hasArg().create()); options.addOption(OptionBuilder .withLongOpt(INDEX_PATH_OPTION).withDescription(String .format("The path to the output index directory. Default: %s", DEFAULT_INDEX_DIRECTORY)) .hasArg().create('o')); options.addOption(OptionBuilder.withLongOpt(REPLACE_INDEX_OPTION) .withDescription("Replace an existing index if it exists. If this option is not specified," + "index processing will fail if an index already exists at the specified location.") .create('r')); return options; }
From source file:com.linkedin.helix.tools.ClusterStateVerifier.java
@SuppressWarnings("static-access") private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info") .create();//ww w. ja va 2s. co m Option zkServerOption = OptionBuilder.withLongOpt(zkServerAddress) .withDescription("Provide zookeeper address").create(); zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("ZookeeperServerAddress(Required)"); Option clusterOption = OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create(); clusterOption.setArgs(1); clusterOption.setRequired(true); clusterOption.setArgName("Cluster name (Required)"); Option timeoutOption = OptionBuilder.withLongOpt(timeout).withDescription("Timeout value for verification") .create(); timeoutOption.setArgs(1); timeoutOption.setArgName("Timeout value (Optional), default=30s"); Option sleepIntervalOption = OptionBuilder.withLongOpt(period) .withDescription("Polling period for verification").create(); sleepIntervalOption.setArgs(1); sleepIntervalOption.setArgName("Polling period value (Optional), default=1s"); Options options = new Options(); options.addOption(helpOption); options.addOption(zkServerOption); options.addOption(clusterOption); options.addOption(timeoutOption); options.addOption(sleepIntervalOption); return options; }
From source file:ambit2.data.qmrf.QMRFObject.java
/** * Example://from w w w .j av a2 s. c o m * <pre> * -e http://nina.acad.bg/qmrf/catalogs_xml.jsp?all=true -c * </pre> * @return */ protected Options createOptions() { Options options = new Options(); Option dtdschema = OptionBuilder.withLongOpt("dtd").withArgName("url").hasArg().withDescription( "DTD schema location - URL where DTD schema resides (e.g. -dfile:///D:/src/ambit/qmrf.dtd or -dhttp://ambit2.acad.bg/qmrf/qmrf.dtd) ") .create("d"); Option content = OptionBuilder.withLongOpt("xmlcontent").withArgName("URL").hasArg() .withDescription("URL to retrieve XML content").create("x"); Option ttf = OptionBuilder.withLongOpt("ttf").withArgName("URL").hasArg() .withDescription("URL to retrieve TrueType font").create("t"); Option help = OptionBuilder.withLongOpt("help").withDescription("This screen").create("h"); Option admin = OptionBuilder.withLongOpt("user").withArgName("username").hasArg() .withDescription("User (if -u admin then Chapter 10 will be editable, otherwise readonly") .create("u"); Option endpoints = OptionBuilder.withLongOpt("external").withArgName("URL").hasArg().withDescription( "URL to retrieve external catalogs in XML format as defined by <!ELEMENT Catalogs > in QMRF DTD schema") .create("e"); Option catalog_cleanup = OptionBuilder.withLongOpt("cleancatalogs") .withDescription("When saving as XML, include only catalog entries which have an idref reference") .create("c"); Option readonlyAttachments = OptionBuilder.withLongOpt("readonly-attachments") .withDescription("Forbids adding/deleting attachments").create("r"); options.addOption(dtdschema); options.addOption(content); options.addOption(admin); options.addOption(help); options.addOption(endpoints); options.addOption(catalog_cleanup); options.addOption(ttf); options.addOption(readonlyAttachments); return options; }
From source file:ambit.data.qmrf.QMRFObject.java
/** * Example:/*from w w w . jav a 2s . c o m*/ * <pre> * -e http://nina.acad.bg/qmrf/catalogs_xml.jsp?all=true -c * </pre> * @return */ protected Options createOptions() { Options options = new Options(); Option dtdschema = OptionBuilder.withLongOpt("dtd").withArgName("url").hasArg().withDescription( "DTD schema location - URL where DTD schema resides (e.g. -dfile:///D:/src/ambit/qmrf.dtd or -dhttp://ambit.acad.bg/qmrf/qmrf.dtd) ") .create("d"); Option content = OptionBuilder.withLongOpt("xmlcontent").withArgName("URL").hasArg() .withDescription("URL to retrieve XML content").create("x"); Option ttf = OptionBuilder.withLongOpt("ttf").withArgName("URL").hasArg() .withDescription("URL to retrieve TrueType font").create("t"); Option help = OptionBuilder.withLongOpt("help").withDescription("This screen").create("h"); Option admin = OptionBuilder.withLongOpt("user").withArgName("username").hasArg() .withDescription("User (if -u admin then Chapter 10 will be editable, otherwise readonly") .create("u"); Option endpoints = OptionBuilder.withLongOpt("external").withArgName("URL").hasArg().withDescription( "URL to retrieve external catalogs in XML format as defined by <!ELEMENT Catalogs > in QMRF DTD schema") .create("e"); Option catalog_cleanup = OptionBuilder.withLongOpt("cleancatalogs") .withDescription("When saving as XML, include only catalog entries which have an idref reference") .create("c"); Option readonlyAttachments = OptionBuilder.withLongOpt("readonly-attachments") .withDescription("Forbids adding/deleting attachments").create("r"); options.addOption(dtdschema); options.addOption(content); options.addOption(admin); options.addOption(help); options.addOption(endpoints); options.addOption(catalog_cleanup); options.addOption(ttf); options.addOption(readonlyAttachments); return options; }
From source file:com.opengamma.bloombergexample.loader.DemoEquityOptionCollarPortfolioLoader.java
private static Option createPortfolioNameOption() { OptionBuilder.withLongOpt("portfolio"); OptionBuilder.withDescription("The name of the portfolio to create/update"); OptionBuilder.hasArg();/*from www. j a va 2 s. co m*/ OptionBuilder.withArgName("resource"); OptionBuilder.isRequired(); return OptionBuilder.create(PORTFOLIO_NAME_OPT); }
From source file:com.opengamma.bloombergexample.loader.DemoEquityOptionCollarPortfolioLoader.java
private static Option createOptionDepthOption() { OptionBuilder.withLongOpt("depth"); OptionBuilder.withDescription("Number of options on either side of the strike price"); OptionBuilder.hasArg();//from w ww .j a v a2 s . c om OptionBuilder.withArgName("resource"); OptionBuilder.isRequired(); return OptionBuilder.create(OPTION_DEPTH_OPT); }
From source file:com.opengamma.bloombergexample.loader.DemoEquityOptionCollarPortfolioLoader.java
private static Option createNumContractsOption() { OptionBuilder.withLongOpt("contracts"); OptionBuilder.withDescription("Number of contracts for each option"); OptionBuilder.hasArg();//from w w w. java 2s. c o m OptionBuilder.withArgName("resource"); OptionBuilder.isRequired(); return OptionBuilder.create(NUM_CONTRACTS_OPT); }
From source file:com.opengamma.bloombergexample.loader.DemoEquityOptionCollarPortfolioLoader.java
private static Option createNumMembersOption() { OptionBuilder.withLongOpt("members"); OptionBuilder.withDescription("Number underlyers from index to include"); OptionBuilder.hasArg();/* www.j a v a2 s.c o m*/ OptionBuilder.withArgName("resource"); OptionBuilder.isRequired(); return OptionBuilder.create(NUM_INDEX_MEMBERS_OPT); }
From source file:DcmQR.java
private static CommandLine parse(String[] args) { Options opts = new Options(); OptionBuilder.withArgName("aet[@host][:port]"); OptionBuilder.hasArg();//from w ww .ja va2s.c om OptionBuilder.withDescription("set AET, local address and listening port of local Application Entity"); 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")); opts.addOption("nossl2", false, "disable SSLv2Hello TLS handshake"); 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("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\nClass may be specified by its UID " + "or by one\nof 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\n" + "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\n" + " separated list of UIDs or by one of following key\n" + " words:\n" + " IVRLE - offer only Implicit VR Little Endian\n" + " Transfer Syntax\n" + " LE - offer Explicit and Implicit VR Little Endian\n" + " Transfer Syntax\n" + " BE - offer Explicit VR Big Endian Transfer Syntax\n" + " DEFL - offer Deflated Explicit VR Little\n" + " 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\n" + " Transfer Syntaxes listed above except No Pixel Data\n" + " and No Pixel Data Delflate Transfer Syntax are\n" + " 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\nby 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\n 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\n" + " response."); opts.addOption("vmf", false, "negotiate private FIND SOP Classes to " + "return attributes of legacy CT/MR images of one series as\n" + " 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\n" + " 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\n" + " by default."); OptionBuilder.withLongOpt("patient"); opts.addOption(OptionBuilder.create("P")); OptionBuilder.withDescription( "perform series level query, multiple " + "exclusive with -P and -I, perform study level query\n" + " by default."); OptionBuilder.withLongOpt("series"); opts.addOption(OptionBuilder.create("S")); OptionBuilder.withDescription( "perform instance level query, multiple " + "exclusive with -P and -S, perform study level query\n" + " by default."); OptionBuilder.withLongOpt("image"); opts.addOption(OptionBuilder.create("I")); 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\n" + "or 00100010. Attributes in nested Datasets can\n" + "be specified by including the name/tag value of\n" + " the sequence attribute, e.g. 00400275/00400009\n" + "for Scheduled Procedure Step ID in the Request\n" + "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")); 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; }