List of usage examples for org.apache.commons.cli OptionBuilder hasArg
public static OptionBuilder hasArg(boolean hasArg)
hasArg
is true. From source file:gov.llnl.lc.smt.command.SmtCommand.java
/** * All the options that are common to all SMT commands. This method should be * included within every init() method, near the top. * /*from w w w . jav a 2s. c o m*/ * @see describe related java objects * * @return ***********************************************************/ protected boolean initMinimumOptions() { // create and initialize the common options for most commands if (options == null) options = new Options(); SmtProperty sp = SmtProperty.SMT_HELP; Option help = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_VERSION; Option version = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_READ_CONFIG; Option cFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_LOG_FILE; Option log_file = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_LOG_LEVEL; Option log_level = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); options.addOption(cFile); options.addOption(log_file); options.addOption(log_level); options.addOption(help); options.addOption(version); return true; }
From source file:com.google.api.ads.adwords.awreporting.AwReporting.java
/** * Creates the command line options.//w w w .j av a 2s. c om * * @return the {@link Options}. */ private static Options createCommandLineOptions() { Options options = new Options(); Option help = new Option("help", "print this message"); options.addOption(help); OptionBuilder.withArgName("file"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("aw-report-sample.properties file."); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("file")); OptionBuilder.withArgName("YYYYMMDD"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("Start date for CUSTOM_DATE Reports (YYYYMMDD)"); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("startDate")); OptionBuilder.withArgName("YYYMMDD"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("End date for CUSTOM_DATE Reports (YYYYMMDD)"); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("endDate")); OptionBuilder.withArgName("DateRangeType"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("ReportDefinitionDateRangeType"); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("dateRange")); OptionBuilder.withArgName("accountIdsFile"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("Consider ONLY the account IDs specified on the file to run the report"); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("accountIdsFile")); OptionBuilder.withArgName("verbose"); OptionBuilder.hasArg(false); OptionBuilder.withDescription("The application will print all the tracing on the console"); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("verbose")); OptionBuilder.withArgName("debug"); OptionBuilder.hasArg(false); OptionBuilder.withDescription( "Will display all the debug information. " + "If the option 'verbose' is activated, " + "all the information will be displayed on the console as well"); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("debug")); OptionBuilder.withArgName("onFileReport"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("This is an experimental argument, where you can specify " + "the report type, and the processor will read the data directly from the CSV file " + "passed on the 'csvReportFile' argument. It's mandatory to pass the 'csvReportFile' " + "argument if you pass this argument."); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("onFileReport")); OptionBuilder.withArgName("csvReportFile"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("This is the path to the CSV report file that will be used to " + "import data directly into AwReporting."); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create("csvReportFile")); return options; }
From source file:gov.llnl.lc.smt.command.utilize.SmtUtilize.java
/** * Describe the method here/*from ww w .ja v a 2 s. c o m*/ * * @see gov.llnl.lc.smt.command.SmtCommand#init() * * @return ***********************************************************/ @Override public boolean init() { USAGE = "[-h=<host url>] [-pn=<port num>] [-rH=<filename> [-pX=<playback multipliers>]] "; HEADER = "\nsmt-utilize - display % bandwidth utilized\n\n"; EXAMPLE = "examples:" + SmtConstants.NEW_LINE + "> smt-utilize -pn 10013 - continuously shows the bandwidth utilization of all ports via the service (long form)" + SmtConstants.NEW_LINE + "> smt-utilize -rH HypeFR.his -pControl -dump -SW - shows the raw switch to switch port utilization from the file using the play controls" + SmtConstants.NEW_LINE + "> smt-utilize -pn 10011 -once -dump -CA - shows the current bandwidth utilization of the ports connected to channel adapters" + SmtConstants.NEW_LINE + "> smt-utilize -rH HypeFR.his -once - shows the first bw utilization for all the ports from the flight recorder file" + SmtConstants.NEW_LINE + "."; // terminate with nl // create and initialize the common options for this command initMinimumOptions(); initConnectionOptions(); initPlayableOptions(); SmtProperty sp = SmtProperty.SMT_READ_OMS_HISTORY; Option rHist = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_DUMP; Option dump = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); Option sw_type = OptionBuilder.hasArg(false).withDescription("analyze only switch to switch ports") .withLongOpt("switch2switch").create("SW"); Option ca_type = OptionBuilder.hasArg(false).withDescription("analyze ports to or from channel adapters") .withLongOpt("edgePort").create("CA"); options.addOption(rHist); options.addOption(dump); options.addOption(sw_type); options.addOption(ca_type); return true; }
From source file:gov.llnl.lc.smt.command.route.SmtMulticast.java
/** * Describe the method here/*from w w w .j a va 2 s .co m*/ * * @see gov.llnl.lc.smt.command.SmtCommand#init() * * @return ***********************************************************/ @Override public boolean init() { USAGE = "[-h=<host url>] [-pn=<port num>] "; HEADER = "smt-multicast - examine one-to-many communication attributes"; EXAMPLE = "examples:" + SmtConstants.NEW_LINE + "> smt-multicast -pn 10011 -q status" + SmtConstants.NEW_LINE + "> smt-multicast -rH surface3h.his -q member 0xf452:1403:0034:2ea1" + SmtConstants.NEW_LINE + "."; // terminate with nl // create and initialize the common options for this command initCommonOptions(); // add non-common options // initialize the command specific options SmtProperty sp = SmtProperty.SMT_QUERY_TYPE; Option qType = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_QUERY_LIST; Option qList = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_STATUS; Option status = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_DUMP; Option dump = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); options.addOption(qType); options.addOption(qList); options.addOption(status); options.addOption(dump); return true; }
From source file:gov.llnl.lc.smt.command.SmtCommand.java
/** * Set up the options for reading files that contain "single" instances of the * fabric. This is the most common type of reading. * // ww w . j a v a2 s . c om * @see describe related java objects * * @return ***********************************************************/ protected boolean initReadFileOptions() { /* support reading of both OMS and Fabric files */ SmtProperty sp = SmtProperty.SMT_READ_OMS; Option roFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); // sp = SmtProperty.SMT_READ_FABRIC; // Option rfFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) // .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) // .create(sp.getShortName()); options.addOption(roFile); // options.addOption(rfFile); return true; }
From source file:gov.llnl.lc.smt.command.privileged.SmtPrivileged.java
/** * Describe the method here//from ww w. j a v a2 s.co m * * @see gov.llnl.lc.smt.command.SmtCommand#init() * * @return ***********************************************************/ @Override public boolean init() { USAGE = "[-v] [-?] "; HEADER = "smt-priv - invokes a privileged command (requires a connection)"; EXAMPLE = "examples:" + SmtConstants.NEW_LINE + "> smt-priv -pn 10011 -X \"hostname\" - invoke the hostname command on the OMS node, and return the results" + SmtConstants.NEW_LINE + "> smt-priv -pn 10013 -dP 14 3 - disable port 3 of node with lid 14" + SmtConstants.NEW_LINE + "> smt-priv -pn 10011 -rt - re-routes the fabric" + SmtConstants.NEW_LINE + "> smt-priv -pn 10013 -uD - updates the node descriptions" + SmtConstants.NEW_LINE + "."; // terminate with nl // create and initialize the common options for this command initConnectionOptions(); // initialize the command specific options SmtProperty sp = SmtProperty.SMT_PRIV_EXT; Option ext = OptionBuilder.hasArg(true).hasArgs().withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_ENABLE; Option enable = OptionBuilder.hasArg(true).hasArgs(2).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_DISABLE; Option disable = OptionBuilder.hasArg(true).hasArgs(2).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_QUERY_PORT; Option query = OptionBuilder.hasArg(true).hasArgs(2).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_OSM_LOG_LEVEL; Option logLevel = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_PM_SWEEP_PERIOD; Option sPeriod = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_UPDATE_DESC; Option update = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_REROUTE; Option reroute = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_PM_CLEAR; Option clear = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_LT_SWEEP; Option lsweep = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_HV_SWEEP; Option hsweep = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_PRIV_PM_SWEEP; Option psweep = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); options.addOption(ext); options.addOption(enable); options.addOption(disable); options.addOption(query); options.addOption(logLevel); options.addOption(sPeriod); options.addOption(update); options.addOption(reroute); options.addOption(clear); options.addOption(lsweep); options.addOption(hsweep); options.addOption(psweep); return true; }
From source file:acromusashi.kafka.log.producer.WinApacheLogProducer.java
/** * ???//from w w w . j a v a2 s. co m * * @return ?? */ public static Options createOptions() { Options cliOptions = new Options(); // OptionBuilder.hasArg(true); OptionBuilder.withArgName("WinApacheLogProducer Conf Path"); OptionBuilder.withDescription("WinApacheLogProducer Conf Path"); OptionBuilder.isRequired(true); Option confPathOption = OptionBuilder.create("c"); // OptionBuilder.withDescription("show help"); Option helpOption = OptionBuilder.create("h"); cliOptions.addOption(confPathOption); cliOptions.addOption(helpOption); return cliOptions; }
From source file:gov.llnl.lc.smt.command.SmtCommand.java
/** * Set up the options for reading files that contain "multiple" instances of * the fabric. Tools that read these types of files are less common. * /* w ww . java 2 s.c om*/ * @see describe related java objects * * @return ***********************************************************/ protected boolean initMulitReadFileOptions() { /* support reading of both OMS and Fabric files */ SmtProperty sp = SmtProperty.SMT_READ_DELTA; Option rdFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_READ_DELTA_HISTORY; Option rdhFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_READ_OMS_HISTORY; Option roFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); // options.addOption(rdFile); // options.addOption(rdhFile); options.addOption(roFile); return true; }
From source file:gov.llnl.lc.smt.command.link.SmtLink.java
/** * Describe the method here/*from ww w.j a va2 s.c o m*/ * * @see gov.llnl.lc.smt.command.SmtCommand#init() * * @return ***********************************************************/ @Override public boolean init() { USAGE = "[-h=<host url>] [-pn=<port num>] "; HEADER = "smt-link - a tool for obtaining high level link information"; EXAMPLE = "examples:" + SmtConstants.NEW_LINE + "> smt-link -pn 10011 -q status - provide a link summary" + SmtConstants.NEW_LINE + "> smt-link -pn 10013 -q errors - show the links that are currently experiencing errors" + SmtConstants.NEW_LINE + "> smt-link -q status 196 17 - show the link associated with lid 196 port 17" + SmtConstants.NEW_LINE + "> smt-link -pn 10013 -q switches -oM T - show only the down links between switches" + SmtConstants.NEW_LINE + "> smt-link -q speed EDR - show all of the EDR links" + SmtConstants.NEW_LINE + "> smt-link -rH surface3h.his -dump - dump all the link information" + SmtConstants.NEW_LINE + "."; // terminate with nl // create and initialize the common options for this command initCommonOptions(); // // add non-common options // initialize the command specific options SmtProperty sp = SmtProperty.SMT_QUERY_TYPE; Option qType = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_QUERY_LIST; Option qList = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_STATUS; Option status = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_DUMP; Option dump = OptionBuilder.hasArg(false).withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_QUERY_LEVEL; Option level = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); sp = SmtProperty.SMT_ONLY_MISSING; Option oMissing = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); options.addOption(qType); options.addOption(qList); options.addOption(status); options.addOption(dump); options.addOption(level); options.addOption(oMissing); return true; }
From source file:gov.llnl.lc.smt.command.SmtCommand.java
/** * Set up the options for reading files that contain "multiple" instances of * the fabric. Tools that read these types of files are MOST common. * //from w ww .ja v a 2 s . c o m * @see describe related java objects * * @return ***********************************************************/ protected boolean initReadHistoryFileOptions() { /* support reading of History files files */ SmtProperty sp = SmtProperty.SMT_READ_OMS_HISTORY; Option roFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()).withValueSeparator('=') .withDescription(sp.getDescription()).withLongOpt(sp.getName()).create(sp.getShortName()); options.addOption(roFile); return true; }