List of usage examples for org.apache.commons.cli Option setArgName
public void setArgName(String argName)
From source file:com.spectralogic.ds3cli.Arguments.java
/** * add an argument option and set its argument name * @param opt Option to add to Arguments Options * @param argName argument name in help display *//*from w w w . jav a 2 s.c om*/ public void addOption(final Option opt, final String argName) { opt.setArgName(argName); this.options.addOption(opt); }
From source file:com.netscape.cmstools.client.ClientCertValidateCLI.java
public void createOptions() { Option option = new Option(null, "certusage", true, "Certificate usage: " + "CheckAllUsages, SSLServer, SSLServerWithStepUp, SSLClient, SSLCA, AnyCA, " + "StatusResponder, ObjectSigner, UserCertImport, ProtectedObjectSigner, " + "VerifyCA, EmailSigner, EmailRecipient."); option.setArgName("certusage"); options.addOption(option);// w w w . j a v a2 s. c o m }
From source file:com.axelor.shell.core.Target.java
private Options getOptions() { if (options != null) { return options; }//from w ww . ja v a 2 s .c o m options = new Options(); int counter = 0; for (CliOption cliOption : cliOptions) { if (cliOption == null) { // variable arguments continue; } Class<?> type = method.getParameterTypes()[counter++]; String name = cliOption.name(); String shortName = "" + cliOption.shortName(); Option option = new Option(shortName, cliOption.help()); option.setType(type); option.setLongOpt(name); option.setRequired(cliOption.required()); option.setArgs(1); if (!isBlank(cliOption.argName())) { option.setArgName(cliOption.argName()); option.setArgs(1); } if (type == boolean.class) { option.setArgs(0); } if (type.isArray()) { option.setArgs(Option.UNLIMITED_VALUES); } options.addOption(option); } return options; }
From source file:com.googlecode.dex2jar.tools.BaseCmd.java
protected void initOptionFromClass(Class<?> clz) { if (clz == null) { return;//from w ww.j a va2 s . com } else { initOptionFromClass(clz.getSuperclass()); } Field[] fs = clz.getDeclaredFields(); for (Field f : fs) { Opt opt = f.getAnnotation(Opt.class); if (opt != null) { f.setAccessible(true); if (!opt.hasArg()) { Class<?> type = f.getType(); if (!type.equals(boolean.class)) { throw new RuntimeException( "the type of " + f + " must be boolean, as it is declared as no args"); } boolean b; try { b = (Boolean) f.get(this); } catch (Exception e) { throw new RuntimeException(e); } if (b) { throw new RuntimeException( "the value of " + f + " must be false, as it is declared as no args"); } } Option option = new Option(opt.opt(), opt.hasArg(), opt.description()); option.setRequired(opt.required()); if (!"".equals(opt.longOpt())) { option.setLongOpt(opt.longOpt()); } if (!"".equals(opt.argName())) { option.setArgName(opt.argName()); } options.addOption(option); map.put(opt.opt(), f); } } }
From source file:edu.vt.middleware.crypt.symmetric.SymmetricCli.java
/** {@inheritDoc} */ protected void initOptions() { super.initOptions(); final Option mode = new Option(OPT_MODE, true, "cipher mode, e.g. CBC"); mode.setArgName("name"); mode.setOptionalArg(false);//from ww w .j a v a 2s .c o m final Option padding = new Option(OPT_PADDING, true, "cipher padding strategy, e.g. PKCS5Padding"); padding.setArgName("padding"); padding.setOptionalArg(false); final Option key = new Option(OPT_KEY, true, "encryption/decryption key"); key.setArgName("filepath"); key.setOptionalArg(false); final Option keySize = new Option(OPT_KEYSIZE, true, "key size in bits; only needed if -key option is not specified"); keySize.setArgName("bits"); keySize.setOptionalArg(false); final Option iv = new Option(OPT_IV, true, "initialization vectory in hex"); iv.setArgName("hex_iv"); iv.setOptionalArg(false); final Option pbe = new Option(OPT_PBE, true, "generate PBE key from password/phrase; uses pkcs5s2 by default"); pbe.setArgName("password"); pbe.setOptionalArg(false); final Option pbeScheme = new Option(OPT_SCHEME, true, "PBE key generation mode; one of pkcs5s1, pkcs5s2, openssl, pkcs12"); pbeScheme.setArgName("name"); pbeScheme.setOptionalArg(false); final Option pbeDigest = new Option(OPT_DIGEST, true, "digest algorithm to use with PBE mode pkcs5s1 or pkcs12"); pbeDigest.setArgName("name"); pbeDigest.setOptionalArg(false); final Option salt = new Option(OPT_SALT, true, "salt for PBE key generation in hex"); salt.setArgName("hex_salt"); salt.setOptionalArg(false); final Option iterations = new Option(OPT_ITERATIONS, true, "iteration count for PBE key generation"); salt.setArgName("count"); salt.setOptionalArg(false); final Option genKey = new Option(OPT_GENKEY, true, "generate key of given size written to path specified by -out option"); genKey.setArgName("bitsize"); genKey.setOptionalArg(false); options.addOption(mode); options.addOption(padding); options.addOption(key); options.addOption(keySize); options.addOption(iv); options.addOption(pbe); options.addOption(pbeScheme); options.addOption(pbeDigest); options.addOption(salt); options.addOption(iterations); options.addOption(genKey); options.addOption(new Option(OPT_ENCRYPT, "perform encryption")); options.addOption(new Option(OPT_DECRYPT, "perform decryption")); }
From source file:com.netscape.cmstools.client.ClientCertImportCLI.java
public void createOptions() { Option option = new Option(null, "cert", true, "Certificate file to import."); option.setArgName("path"); options.addOption(option);/*from www . ja v a 2 s .co m*/ option = new Option(null, "ca-cert", true, "CA certificate file to import."); option.setArgName("path"); options.addOption(option); option = new Option(null, "pkcs7", true, "PKCS #7 file to import."); option.setArgName("path"); options.addOption(option); option = new Option(null, "pkcs12", true, "PKCS #12 file to import."); option.setArgName("path"); options.addOption(option); option = new Option(null, "pkcs12-password", true, "PKCS #12 password."); option.setArgName("password"); options.addOption(option); option = new Option(null, "pkcs12-password-file", true, "PKCS #12 password file."); option.setArgName("path"); options.addOption(option); options.addOption(null, "ca-server", false, "Import CA certificate from CA server"); option = new Option(null, "serial", true, "Serial number of certificate to import from CA server"); option.setArgName("serial number"); options.addOption(option); option = new Option(null, "trust", true, "Trust attributes."); option.setArgName("trust attributes"); options.addOption(option); }
From source file:de.uni_koblenz.jgralab.utilities.csv2tg.Csv2Tg.java
final protected OptionHandler createOptionHandler() { String toolString = "java " + this.getClass().getName(); String versionString = JGraLab.getInfo(false); OptionHandler oh = new OptionHandler(toolString, versionString); Option schema = new Option("s", CLI_OPTION_SCHEMA, true, "(required): the schema according to which the graph should be constructed."); schema.setRequired(true);/*from w ww . ja va 2 s . co m*/ schema.setArgName("file"); oh.addOption(schema); Option csvFiles = new Option("i", CLI_OPTION_CSV_FILES, true, "(required): set of csv-file containing vertex / edge instance informations."); csvFiles.setRequired(true); csvFiles.setArgs(Option.UNLIMITED_VALUES); csvFiles.setArgName("files_or_folder"); csvFiles.setValueSeparator(' '); oh.addOption(csvFiles); Option output = new Option("o", CLI_OPTION_OUTPUT_FILE, true, "(required): the output file name, or empty for stdout"); output.setRequired(true); output.setArgName("file"); oh.addOption(output); return oh; }
From source file:com.opengamma.bbg.cli.BloombergCliOptions.java
private Option createFieldsOption() { Option option = new Option("F", FIELDS_OPTION, true, "List of bloomberg fields"); option.setArgName("PX_LAST,VOLUME,LAST_VOLATILITY"); option.setRequired(_dataFieldsRequired); return option; }
From source file:com.opengamma.bbg.cli.BloombergCliOptions.java
private Option createDataProviderOption() { Option option = new Option("p", DATAPROVIDERS_OPTION, true, "List of data providers"); option.setArgName("CMPL,CMPT"); option.setRequired(_dataProvidersRequired); return option; }
From source file:henplus.commands.ConnectCommand.java
@Override public Collection<Option> getHandledCommandLineOptions() { final Collection<Option> result = new LinkedList<Option>(); final Option option = new Option("J", "url", true, "JDBC URL to connect to"); option.setArgName("jdbc:..."); result.add(option);/*from ww w. j a va 2 s .c o m*/ final Option option2 = new Option("U", "username", true, "Username to connect with"); option2.setArgName("username"); result.add(option2); final Option option3 = new Option("P", "password", true, "Password to connect with"); option3.setArgName("password"); result.add(option3); return result; }