Search in sources :

Example 46 with Option

use of org.apache.commons.cli.Option in project GNS by MobilityFirst.

the class ThroughputAsynchMultiClientTest method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option helpOption = new Option("help", "Prints Usage");
    Option aliasOption = OptionBuilder.withArgName("alias").hasArg().withDescription("the alias (HRN) to use").create("alias");
    Option operationOption = OptionBuilder.withArgName("op").hasArg().withDescription("the operation to perform (read or update - default is read)").create("op");
    Option rateOption = OptionBuilder.withArgName("rate").hasArg().withDescription("the rate in ops per second").create("rate");
    Option incOption = OptionBuilder.withArgName("inc").hasArg().withDescription("the increment used with rate").create("inc");
    Option clientsOption = OptionBuilder.withArgName("clients").hasArg().withDescription("number of clients used to send (default 10)").create("clients");
    Option requestsPerClientOption = OptionBuilder.withArgName("requests").hasArg().withDescription("number of requests sent by each client each time").create("requests");
    Option guidsPerRequestOption = OptionBuilder.withArgName("guids").hasArg().withDescription("number of guids for each request").create("guids");
    Option useExistingGuidsOption = new Option("useExistingGuids", "use guids in account Guid instead of creating new ones");
    Option updateAliasOption = new Option("updateAlias", true, "Alias of guid to update/read");
    Option updateFieldOption = new Option("updateField", true, "Field to read/update");
    Option updateValueOption = new Option("updateValue", true, "Value to use in read/update");
    commandLineOptions = new Options();
    commandLineOptions.addOption(aliasOption);
    commandLineOptions.addOption(operationOption);
    commandLineOptions.addOption(rateOption);
    commandLineOptions.addOption(incOption);
    commandLineOptions.addOption(clientsOption);
    commandLineOptions.addOption(requestsPerClientOption);
    commandLineOptions.addOption(guidsPerRequestOption);
    commandLineOptions.addOption(helpOption);
    commandLineOptions.addOption(updateAliasOption);
    commandLineOptions.addOption(updateFieldOption);
    commandLineOptions.addOption(updateValueOption);
    commandLineOptions.addOption(useExistingGuidsOption);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 47 with Option

use of org.apache.commons.cli.Option in project GNS by MobilityFirst.

the class ReplicaLatencyTest method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option help = new Option("help", "Prints Usage");
    Option alias = OptionBuilder.withArgName("alias").hasArg().withDescription("the alias (HRN) to use for the account").create("alias");
    Option host = OptionBuilder.withArgName("host").hasArg().withDescription("the GNS host").create("host");
    Option port = OptionBuilder.withArgName("port").hasArg().withDescription("the GNS port").create("port");
    Option debug = new Option("debug", "show output");
    Option closeActiveReplica = OptionBuilder.withArgName("closeAR").hasArg().withDescription("the active replica close to you").create("closeAR");
    commandLineOptions = new Options();
    commandLineOptions.addOption(alias);
    commandLineOptions.addOption(host);
    commandLineOptions.addOption(port);
    commandLineOptions.addOption(debug);
    commandLineOptions.addOption(closeActiveReplica);
    commandLineOptions.addOption(help);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 48 with Option

use of org.apache.commons.cli.Option in project GNS by MobilityFirst.

the class CommandLineInterface method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option help = new Option("help", "Prints Usage");
    Option silent = new Option("silent", "Disables output");
    Option noDefaults = new Option("noDefaults", "Don't use server and guid defaults");
    commandLineOptions = new Options();
    commandLineOptions.addOption(help);
    commandLineOptions.addOption(silent);
    commandLineOptions.addOption(noDefaults);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args, false);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 49 with Option

use of org.apache.commons.cli.Option in project GNS by MobilityFirst.

the class GNSInstaller method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option help = new Option("help", "Prints Usage");
    Option update = OptionBuilder.withArgName("installation name").hasArg().withDescription("updates GNS files and restarts servers in a installation").create("update");
    Option restart = OptionBuilder.withArgName("installation name").hasArg().withDescription("restarts GNS servers in a installation").create("restart");
    Option removeLogs = new Option("removeLogs", "remove paxos and Logger log files (use with -restart or -update)");
    Option deleteDatabase = new Option("deleteDatabase", "delete the databases in a installation (use with -restart or -update)");
    Option dataStore = OptionBuilder.withArgName("data store type").hasArg().withDescription("data store type").create("datastore");
    Option scriptFile = OptionBuilder.withArgName("install script file").hasArg().withDescription("specifies the location of a bash script file that will install MongoDB and Java").create("scriptFile");
    Option runscript = OptionBuilder.withArgName("installation name").hasArg().withDescription("just runs the script file").create("runscript");
    Option stop = OptionBuilder.withArgName("installation name").hasArg().withDescription("stops GNS servers in a installation").create("stop");
    Option root = new Option("root", "run the installation as root");
    Option noopTest = new Option("noopTest", "starts noop test servers instead of GNS APP servers");
    commandLineOptions = new Options();
    commandLineOptions.addOption(update);
    commandLineOptions.addOption(restart);
    commandLineOptions.addOption(stop);
    commandLineOptions.addOption(removeLogs);
    commandLineOptions.addOption(deleteDatabase);
    commandLineOptions.addOption(dataStore);
    commandLineOptions.addOption(scriptFile);
    commandLineOptions.addOption(runscript);
    commandLineOptions.addOption(root);
    commandLineOptions.addOption(noopTest);
    commandLineOptions.addOption(help);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 50 with Option

use of org.apache.commons.cli.Option in project shifu by ShifuML.

the class ShifuCLI method buildModelSetOptions.

@SuppressWarnings("static-access")
private static Options buildModelSetOptions(String[] args) {
    Options opts = new Options();
    Option opt_cmt = OptionBuilder.hasArg().withDescription("The description for new model").create(MODELSET_CMD_M);
    Option opt_new = OptionBuilder.hasArg().withDescription("To create an eval set").create(NEW);
    Option opt_type = OptionBuilder.hasArg().withDescription("Specify model type").create(MODELSET_CMD_TYPE);
    Option opt_run = OptionBuilder.hasOptionalArg().withDescription("To run eval set").create(EVAL_CMD_RUN);
    Option opt_dry = OptionBuilder.hasArg(false).withDescription("Dry run the train").create(TRAIN_CMD_DRY);
    Option opt_debug = OptionBuilder.hasArg(false).withDescription("Save the log of train process").create(TRAIN_CMD_DEBUG);
    Option opt_model = OptionBuilder.hasArg(false).withDescription("Init model").create(INIT_CMD_MODEL);
    Option opt_concise = OptionBuilder.hasArg(false).withDescription("Export concise PMML").create(EXPORT_CONCISE);
    Option opt_reset = OptionBuilder.hasArg(false).withDescription("Reset all variables to finalSelect = false").create(RESET);
    Option opt_correlation = OptionBuilder.hasArg(false).withDescription("Compute corrlation value for all column pairs.").create(CORRELATION);
    Option opt_correlation_short = OptionBuilder.hasArg(false).withDescription("Compute corrlation value for all column pairs.").create("c");
    Option opt_shuffle = OptionBuilder.hasArg(false).withDescription("Shuffle data after normalization").create(SHUFFLE);
    Option opt_resume = OptionBuilder.hasArg(false).withDescription("Resume combo model training.").create(RESUME);
    Option opt_list = OptionBuilder.hasArg(false).create(LIST);
    Option opt_delete = OptionBuilder.hasArg().create(DELETE);
    Option opt_score = OptionBuilder.hasArg().create(SCORE);
    Option opt_confmat = OptionBuilder.hasArg().create(CONFMAT);
    Option opt_perf = OptionBuilder.hasArg().create(PERF);
    Option opt_norm = OptionBuilder.hasArg().create(NORM);
    Option opt_eval = OptionBuilder.hasArg(false).create(EVAL_CMD);
    Option opt_init = OptionBuilder.hasArg(false).create(INIT_CMD);
    Option opt_rebin = OptionBuilder.hasArg(false).create(REBIN);
    Option opt_vars = OptionBuilder.hasArg().create(VARS);
    Option opt_n = OptionBuilder.hasArg().create(N);
    Option opt_ivr = OptionBuilder.hasArg().create(IVR);
    Option opt_bic = OptionBuilder.hasArg().create(BIC);
    Option opt_save = OptionBuilder.hasArg(false).withDescription("save model").create(SAVE);
    Option opt_switch = OptionBuilder.hasArg(false).withDescription("switch model").create(SWITCH);
    Option opt_eval_model = OptionBuilder.hasArg().withDescription("").create(EVAL_MODEL);
    opts.addOption(opt_cmt);
    opts.addOption(opt_new);
    opts.addOption(opt_type);
    opts.addOption(opt_run);
    opts.addOption(opt_perf);
    opts.addOption(opt_norm);
    opts.addOption(opt_dry);
    opts.addOption(opt_debug);
    opts.addOption(opt_model);
    opts.addOption(opt_concise);
    opts.addOption(opt_reset);
    opts.addOption(opt_eval);
    opts.addOption(opt_init);
    opts.addOption(opt_shuffle);
    opts.addOption(opt_resume);
    opts.addOption(opt_list);
    opts.addOption(opt_delete);
    opts.addOption(opt_score);
    opts.addOption(opt_confmat);
    opts.addOption(opt_save);
    opts.addOption(opt_switch);
    opts.addOption(opt_eval_model);
    opts.addOption(opt_correlation);
    opts.addOption(opt_correlation_short);
    opts.addOption(opt_rebin);
    opts.addOption(opt_vars);
    opts.addOption(opt_n);
    opts.addOption(opt_ivr);
    opts.addOption(opt_bic);
    return opts;
}
Also used : Options(org.apache.commons.cli.Options) Option(org.apache.commons.cli.Option)

Aggregations

Option (org.apache.commons.cli.Option)152 Options (org.apache.commons.cli.Options)105 CommandLine (org.apache.commons.cli.CommandLine)53 CommandLineParser (org.apache.commons.cli.CommandLineParser)52 ParseException (org.apache.commons.cli.ParseException)41 GnuParser (org.apache.commons.cli.GnuParser)39 HelpFormatter (org.apache.commons.cli.HelpFormatter)30 File (java.io.File)13 OptionGroup (org.apache.commons.cli.OptionGroup)13 FileInputStream (java.io.FileInputStream)10 IOException (java.io.IOException)10 HashMap (java.util.HashMap)9 DefaultParser (org.apache.commons.cli.DefaultParser)9 Properties (java.util.Properties)8 BasicParser (org.apache.commons.cli.BasicParser)6 ConsoleAppender (org.apache.log4j.ConsoleAppender)6 PatternLayout (org.apache.log4j.PatternLayout)6 ArrayList (java.util.ArrayList)5 PosixParser (org.apache.commons.cli.PosixParser)5 List (java.util.List)3