Example usage for org.apache.commons.cli OptionBuilder withArgName

List of usage examples for org.apache.commons.cli OptionBuilder withArgName

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionBuilder withArgName.

Prototype

public static OptionBuilder withArgName(String name) 

Source Link

Document

The next Option created will have the specified argument value name.

Usage

From source file:com.comcast.oscar.cli.commands.JSONtoTLV.java

/**
 * Set option parameters for command JSON to TLV display
 * @return Option// w  w w.j  a  v  a2s.  c  om
 */
public static final Option OptionParameters() {
    OptionBuilder.withArgName("filename");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("json2tlv");
    OptionBuilder.withDescription("View the TLV number of a JSON array within the file.");
    return OptionBuilder.create("j2t");
}

From source file:com.denimgroup.threadfix.cli.OptionsHolder.java

@SuppressWarnings("static-access")
public static Options getOptions() {
    Options options = new Options();

    Option property = OptionBuilder.withArgName("unsafe-ssl").hasArgs(1).withValueSeparator()
            .withDescription("unsafe-ssl to force ThreadFix to accept unsigned certificates.").create("D");
    options.addOption(property);//ww  w.ja va2s  .  c  o  m

    Option teams = OptionBuilder.withLongOpt("teams")
            .withDescription("Fetches a list of ThreadFix teams and applications.").create("t");
    options.addOption(teams);

    Option teamsPrettyPrint = OptionBuilder.withLongOpt("teamsPrettyPrint")
            .withDescription(
                    "Fetches a human readable list of ThreadFix teams, applications, and application IDs.")
            .create("tpp");
    options.addOption(teamsPrettyPrint);

    options.addOption(new Option("help", "Print this message"));

    Option set = OptionBuilder.withArgName("property> <value").hasArgs(2).withLongOpt("set")
            .withDescription("Set either the url (ThreadFix base url) or key (ThreadFix API key) properties")
            .create("s");
    options.addOption(set);

    Option search = OptionBuilder.hasOptionalArgs().withLongOpt("vulnerabilitySearch").withDescription(
            "Query the vulnerabilities using various optional parameters. More information can "
                    + "be found at https://github.com/denimgroup/threadfix/wiki/Threadfix-REST-Interface")
            .create("search");
    options.addOption(search);

    Option queueScan = OptionBuilder.withArgName("applicationId> <scannerName> <[scan profile Id]").hasArgs(3)
            .withLongOpt("queueScan")
            .withDescription("Queue a scan for the given applicationId with the given scanner type")
            .create("q");
    options.addOption(queueScan);

    Option addAppUrl = OptionBuilder.withArgName("applicationId> <appUrl").hasArgs(2).withLongOpt("addAppUrl")
            .withDescription("Add URL for the given applicationId").create("au");
    options.addOption(addAppUrl);

    Option setTaskConfig = OptionBuilder.withArgName("applicationId> <scannerName> <file").hasArgs(3)
            .withLongOpt("setTaskConfig")
            .withDescription(
                    "Save the scan configuration for the given applicationId with the given scanner type")
            .create("stc");
    options.addOption(setTaskConfig);

    Option setParameters = OptionBuilder.withArgName("appId> <frameworkType> <repositoryUrl").hasArgs(3)
            .withLongOpt("setParameters")
            .withDescription("Set scan parameters. Available parameters can be found with --printScanOptions")
            .create("sp");
    options.addOption(setParameters);

    options.addOption(new Option("printScanOptions", "Prints available scan options"));

    options.addOption(new Option("printScannerNames", "Prints scanner names supported by ScanAgent"));

    Option createTeam = OptionBuilder.withArgName("name").hasArg().withLongOpt("create-team")
            .withDescription("Creates a ThreadFix team and returns its JSON.").create("ct");
    options.addOption(createTeam);

    Option createApp = OptionBuilder.withArgName("teamId> <name> <url").hasArgs(3).withLongOpt("create-app")
            .withDescription("Creates a ThreadFix application and returns its JSON.").create("ca");
    options.addOption(createApp);

    Option createWaf = OptionBuilder.withArgName("name> <wafTypeName").hasArgs(2).withLongOpt("create-waf")
            .withDescription("Creates a ThreadFix WAF and returns its JSON.").create("cw");
    options.addOption(createWaf);

    Option searchTeam = OptionBuilder.withArgName("property> <value").hasArgs(2).withLongOpt("search-team")
            .withDescription("Searches for a ThreadFix team and returns its JSON.").create("st");
    options.addOption(searchTeam);

    Option searchWaf = OptionBuilder.withArgName("property> <value").hasArgs(2).withLongOpt("search-waf")
            .withDescription("Searches for a ThreadFix WAF and returns its JSON.").create("sw");
    options.addOption(searchWaf);

    Option searchApp = OptionBuilder.withArgName("property> <value1> <value2").hasArgs(3)
            .withLongOpt("search-app")
            .withDescription("Searches for a ThreadFix application and returns its JSON.").create("sa");
    options.addOption(searchApp);

    Option upload = OptionBuilder.withArgName("appId> <file").hasArgs(2).withLongOpt("upload")
            .withDescription("Uploads a scan to the specified application.").create("u");
    options.addOption(upload);

    Option getRules = OptionBuilder.withArgName("wafId").hasArg().withLongOpt("rules")
            .withDescription("Gets WAF Rules and returns its JSON.").create("r");
    options.addOption(getRules);

    Option getRulesForApp = OptionBuilder.withArgName("wafId> <applicationId").hasArgs(2)
            .withLongOpt("rules-for-application")
            .withDescription("Gets WAF Rules for an application and returns its JSON.").create("ra");
    options.addOption(getRulesForApp);

    Option createTag = OptionBuilder.withArgName("name> <[tagType]").hasArgs(2).withLongOpt("create-tag")
            .withDescription(
                    "Creates a ThreadFix Tag and returns its JSON. tagType is optional, default is Application Tag.")
            .create("ctg");
    options.addOption(createTag);

    Option searchTag = OptionBuilder.withArgName("property> <value").withValueSeparator(' ').hasArgs(2)
            .withLongOpt("search-tag")
            .withDescription("Searches for ThreadFix Tags by either name or id, and returns their JSON.")
            .create("stg");
    options.addOption(searchTag);

    Option updateTag = OptionBuilder.withArgName("tagId> <name").hasArgs(2).withLongOpt("update-tag")
            .withDescription("Update ThreadFix Tag, and returns their JSON.").create("utg");
    options.addOption(updateTag);

    Option removeTag = OptionBuilder.withArgName("tagId").hasArgs(1).withLongOpt("remove-tag")
            .withDescription("Remove ThreadFix Tag, and returns message.").create("rtg");
    options.addOption(removeTag);

    Option tags = OptionBuilder.withLongOpt("tags").withDescription("Fetches a list of ThreadFix tags.")
            .create("tg");
    options.addOption(tags);

    Option addAppTag = OptionBuilder.withArgName("applicationId> <tagId").withValueSeparator(' ').hasArgs(2)
            .withLongOpt("addAppTag").withDescription("Add Tag for the given applicationId").create("aat");
    options.addOption(addAppTag);

    Option removeAppTag = OptionBuilder.withArgName("applicationId> <tagId").withValueSeparator(' ').hasArgs(2)
            .withLongOpt("removeAppTag").withDescription("Remove Tag for the given applicationId")
            .create("rat");
    options.addOption(removeAppTag);

    Option addComment = OptionBuilder.withArgName("vulnId> <comment> <[commentTagIds]").hasArgs(3)
            .withLongOpt("add-comment")
            .withDescription("Add comment to a vulnerability. CommentTagIds is optional, separated by comma.")
            .create("ac");
    options.addOption(addComment);

    Option submitDefect = OptionBuilder.withArgName("applicationId> <[vulnerabilityIds]> <[*]").hasArgs(1)
            .hasOptionalArgs().withLongOpt("submit-defect")
            .withDescription("Submit a defect to the defect tracker configured for a specific application.")
            .create("sd");
    options.addOption(submitDefect);

    Option getDefectParameters = OptionBuilder.withArgName("applicationId>").hasArgs(1)
            .withLongOpt("get-defect-parameters")
            .withDescription("Get a list of parameters from the defect tracker given an application ID.")
            .create("gdp");
    options.addOption(getDefectParameters);

    return options;
}

From source file:com.comcast.oscar.cli.commands.OID.java

/**
 * Set option parameters for command OID
 * @return Option/* w w w  .java2  s . co m*/
 */
public static Option OptionParameters() {
    OptionBuilder.withArgName("[<OID>][<value>][<data type>]");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("OID");
    OptionBuilder.withDescription("Insert this OID into a file when compiling. "
            + "Multiple OIDs can be inserted simultaneously (space delimited). " + "Applicable datatypes: "
            + BERService.getDataTypeStringList());
    return OptionBuilder.create("O");
}

From source file:com.comcast.oscar.cli.commands.TFTPServer.java

/**
 * Set option parameters for command TFTP Server Address
 * @return Option/*from   w  ww  .  j a  v  a2 s  . c  o  m*/
 */
public static final Option OptionParameters() {
    OptionBuilder.withArgName("v4/v6=<tftp address>");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("tftp");
    OptionBuilder.withDescription("Add this TFTP server during file compilation. "
            + "For IPv4 use this format for the argument: v4=<server address>. "
            + "For IPv6 use this format for the argument: v6=<server address>. "
            + "Both address versions can be inserted simultaneously (space delimited).");
    return OptionBuilder.create("T");
}

From source file:com.comcast.oscar.cli.commands.CVC.java

/**
 * Set option parameters for command CVC
 * @return Option/*from   www  . j  a v  a2 s. com*/
 */
public static final Option OptionParameters() {
    OptionBuilder.withArgName("c/m=<filename>");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("certificate");
    OptionBuilder.withDescription("Add this CVC during file compilation. "
            + "For CoSigner use this format for the argument: c=<filename>. "
            + "For Manufacturer use this format for the argument: m=<filename>. "
            + "Both CVCs can be inserted simultaneously (space delimited).");
    return OptionBuilder.create("cvc");
}

From source file:com.boulmier.machinelearning.jobexecutor.JobExecutor.java

@SuppressWarnings("static-access")
public static Options defineOptions() {
    Options softwareOptions = new Options();
    Option ipOption = OptionBuilder.withArgName(JobExecutorConfig.OPTIONS.CMD.SHORTIPFIELD)
            .withLongOpt(JobExecutorConfig.OPTIONS.CMD.LONGIPFIELD)
            .isRequired(JobExecutorConfig.OPTIONS.CMD.ISIPREQUIERED)
            .withDescription(JobExecutorConfig.OPTIONS.CMD.IPDESCRIPTION).hasArg().create(),
            portOption = OptionBuilder.withArgName(JobExecutorConfig.OPTIONS.CMD.SHORTPORTFIELD)
                    .withLongOpt(JobExecutorConfig.OPTIONS.CMD.LONGPORTFIELD)
                    .withDescription(JobExecutorConfig.OPTIONS.CMD.PORTDESCRIPTION)
                    .withType(JobExecutorConfig.OPTIONS.CMD.PORTTYPE).hasArg().create(),
            mongoIpOption = OptionBuilder.withArgName(JobExecutorConfig.OPTIONS.CMD.SHORTMONGOIPFIELD)
                    .withLongOpt(JobExecutorConfig.OPTIONS.CMD.LONGMONGOIPFIELD)
                    .withDescription(JobExecutorConfig.OPTIONS.CMD.MONGOIPDESCRIPTION)
                    .isRequired(JobExecutorConfig.OPTIONS.CMD.ISMONGOIPREQUIERED).hasArg().create(),
            mongoPortOption = OptionBuilder.withArgName(JobExecutorConfig.OPTIONS.CMD.SHORTMONGOPORTFIELD)
                    .withLongOpt(JobExecutorConfig.OPTIONS.CMD.LONGMONGOPORTFIELD)
                    .withDescription(JobExecutorConfig.OPTIONS.CMD.MONGOPORTDESCRIPTION).withType(int.class)
                    .hasArg().create(),//  w  ww  .  j a v a  2s  .c o m
            decryptKeyOption = OptionBuilder.withArgName("key").withLongOpt("decrypt-key").isRequired(true)
                    .hasArg(true).create(),
            debugOption = OptionBuilder.withArgName(JobExecutorConfig.OPTIONS.CMD.SHORTDEBUGFIELD)
                    .withLongOpt(JobExecutorConfig.OPTIONS.CMD.LONGDEBUGFIELD).create();

    softwareOptions.addOption(ipOption);
    softwareOptions.addOption(portOption);
    softwareOptions.addOption(mongoIpOption);
    softwareOptions.addOption(debugOption);
    softwareOptions.addOption(mongoPortOption);
    softwareOptions.addOption(decryptKeyOption);
    return softwareOptions;
}

From source file:com.liveramp.hank.util.CliUtils.java

@SuppressWarnings("static-access")
public static Option buildOneArgOption(String name, String description, String argName, boolean required,
        String longOpt) {/*from   w w w.  ja  va 2 s.c  om*/
    return OptionBuilder.withArgName(argName).hasArg().isRequired(required).withDescription(description)
            .withLongOpt(longOpt).create(name);
}

From source file:com.comcast.oscar.cli.commands.DigitmapInsert.java

/**
 * Set option parameters for command Digitmap Insert
 * @return Option//ww w .j  av a2 s  . co m
 */
public static final Option OptionParameters() {
    OptionBuilder.withArgName("[<filename>][<OID>]");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("digitmap");
    OptionBuilder.withDescription("Insert this DigitMap into a file when compiling - PacketCable ONLY. "
            + "Multiple DigitMaps can be inserted simultaneously (space delimited). " + "OID optional.");
    return OptionBuilder.create("dm");
}

From source file:com.comcast.oscar.cli.commands.Specification.java

/**
 * Set option parameters for command Specification
 * @return Option//from   w  ww.j a  v a2  s. com
 */
public static final Option OptionParameters() {
    OptionBuilder.withArgName("d{ocsis}|p{acketcable}|d{po}e> <version");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("spec");
    OptionBuilder.withDescription(
            "Set specification and version of the file to be compiled/decompiled EX: -s d 1.1 (DOCSIS 1.1) / -s p 1.5 (PacketCable 1.5).");
    return OptionBuilder.create("s");
}

From source file:com.comcast.oscar.cli.commands.MergeBulk.java

/**
 * Set option parameters for command Maximum CPE
 * @return Option/*from   ww  w. j  a v  a 2  s. c o m*/
 */
public static final Option OptionParameters() {
    OptionBuilder.withArgName("input dirs> <o=<output dir>> <e=<extension>> <b{inary}/t{ext}");
    OptionBuilder.hasArgs();
    OptionBuilder.hasOptionalArgs();
    OptionBuilder.withValueSeparator(' ');
    OptionBuilder.withLongOpt("mergebulkbuild");
    OptionBuilder.withDescription("Merge multiple text files from directories into one binary. "
            + "EX: -mbb inputDirectoryModel inputDirectoryTier inputDirectoryCPE o=outputDirectory e=bin text. "
            + "Output directory, extension and b{inary}/t{ext} are optional.");
    return OptionBuilder.create("mbb");
}