Example usage for org.apache.commons.cli2 CommandLine getValue

List of usage examples for org.apache.commons.cli2 CommandLine getValue

Introduction

In this page you can find the example usage for org.apache.commons.cli2 CommandLine getValue.

Prototype

Object getValue(final Option option) throws IllegalStateException;

Source Link

Document

Retrieves the single Argument value associated with the specified Option

Usage

From source file:egat.cli.eminform.EpsilonMinFormCommandHandler.java

@Override
protected void handleAdditionalChildOptions(CommandLine commandLine) throws CommandProcessingException {
    maxSize = Integer.parseInt(commandLine.getValue(maxSizeOption).toString());

    if (commandLine.hasOption(toleranceOption)) {
        tolerance = Double.parseDouble(commandLine.getValue(toleranceOption).toString());
    } else {// w w w .j  a v a 2  s.  c  om
        tolerance = 1e-8;
    }

    if (commandLine.hasOption(maxQueueOption)) {
        maxQueue = Integer.parseInt(commandLine.getValue(maxQueueOption).toString());
    } else {
        maxQueue = Integer.MAX_VALUE;
    }

    breadth = commandLine.hasOption(breadthOption);
    epsilonGreedy = commandLine.hasOption(epsilonGreedyOption);
    tauGreedy = commandLine.hasOption(tauGreedyOption);
}

From source file:de.tu_chemnitz.mi.barcd.app.CommandLineArgumentsParser.java

/**
 * @param args the arguments as passed to a main function
 *
 * @return the parsed options, null if the arguments could no be parsed
 *///from  www  . j a  v a2  s .  co m
public Options parse(String[] args) {
    CommandLine commandLine = parser.parseAndHelp(args);
    if (commandLine == null) {
        return null;
    }
    Options options = new Options();
    options.setJobFile((File) commandLine.getValue("--job"));
    options.setXmlSchemaUrl((URL) commandLine.getValue("--xml-schema"));
    options.setDisplay(commandLine.getSwitch("+display"));
    options.setPersist(commandLine.getSwitch("+persist"));
    return options;
}

From source file:com.ibm.jaql.util.shell.JaqlShellArguments.java

@SuppressWarnings("unchecked")
static JaqlShellArguments parseArgs(String... args) {
    // option builders
    final DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    final ArgumentBuilder abuilder = new ArgumentBuilder();
    final GroupBuilder gbuilder = new GroupBuilder();

    // create standard options
    Option optHelp = obuilder.withShortName("h").withShortName("?").withLongName("help")
            .withDescription("print this message").create();

    Option optJars = obuilder.withShortName("j").withLongName("jars")
            .withDescription(//from  w ww . j a v a  2s  .  com
                    "comma-separated list of jar files to include user defined expressions or data stores")
            .withArgument(abuilder.withName("args").withMinimum(1).withMaximum(1).create()).create();

    Option optSearchPath = obuilder.withShortName("jp").withLongName("jaql-path")
            .withDescription("colon seperated list of all search path entries")
            .withArgument(abuilder.withName("args").withMinimum(1).withMaximum(1).create()).create();

    Option optBatch = obuilder.withShortName("b").withLongName("batch")
            .withDescription("run in batch mode (i.e., do not read from stdin)").create();

    Option optOutOptions = obuilder.withShortName("o").withLongName("outoptions")
            .withDescription("output options: json, del and xml or an output IO descriptor. "
                    + "This option is ignored when not running in batch mode.")
            .withArgument(abuilder.withName("outoptions").withMinimum(1).withMaximum(1).create()).create();

    Option optEval = obuilder.withShortName("e").withLongName("eval")
            .withDescription("evaluate Jaql expression")
            .withArgument(abuilder.withName("expr").withMinimum(1).withMaximum(1).create()).create();

    // create mini-cluster options
    Option optCluster = obuilder.withShortName("c").withLongName("cluster")
            .withDescription("use existing cluster (i.e., do not launch a mini-cluster)").create();

    Option optNumNodes = obuilder.withShortName("n").withLongName("no-nodes")
            .withDescription("mini-cluster option: number of nodes to spawn")
            .withArgument(abuilder.withName("arg").withMinimum(1).withMaximum(1)
                    .withValidator(NumberValidator.getIntegerInstance()).create())
            .create();

    Option optDir = obuilder.withShortName("d").withLongName("hdfs-dir")
            .withDescription("mini-cluster option: root HDFs directory")
            .withArgument(abuilder.withName("arg").withMinimum(1).withMaximum(1).create()).create();

    Group clusterOptions = gbuilder.withName("Cluster options").withOption(optCluster).withOption(optDir)
            .withOption(optNumNodes).create();

    // create input files option
    Option optInputFiles = abuilder.withName("file").withDescription("list of input files").withMinimum(0)
            .create();

    Option optLog = obuilder.withShortName("l").withLongName("log")
            .withDescription("log options: json, del and xml or an output IO descriptor. ")
            .withArgument(abuilder.withName("arg").withMinimum(1).withMaximum(1).create()).create();

    // combine all options
    Group options = gbuilder.withName("options").withOption(optHelp).withOption(optJars)
            .withOption(optSearchPath).withOption(optBatch).withOption(optLog).withOption(optOutOptions)
            .withOption(optEval).withOption(optInputFiles).withOption(clusterOptions).create();

    // parse and print help if necessary
    CommandLine cl;
    try {
        Parser parser = new Parser();
        parser.setGroup(options);
        cl = parser.parse(args);
    } catch (OptionException e) {
        printHelpAndExit(e, null, options);
        return null;
    }
    if (cl.hasOption(optHelp)) {
        printHelpAndExit(null, options);
    }

    // validate arguments
    JaqlShellArguments result = new JaqlShellArguments();

    // mini-cluster options         
    if (cl.hasOption(optCluster)) {
        result.useExistingCluster = true;
    }
    if (cl.hasOption(optDir)) {
        if (result.useExistingCluster) {
            printHelpAndExit("Options " + optCluster.getPreferredName() + " and " + optDir.getPreferredName()
                    + " are mutually exclusive", options);
        }
        result.hdfsDir = (String) cl.getValue(optDir);
    }
    if (cl.hasOption(optNumNodes)) {
        if (result.useExistingCluster) {
            printHelpAndExit("Options " + optCluster.getPreferredName() + " and "
                    + optNumNodes.getPreferredName() + " are mutually exclusive", options);
        }
        result.numNodes = ((Number) cl.getValue(optNumNodes)).intValue();
    }

    // jar files
    if (cl.hasOption(optJars)) {
        result.jars = ((String) cl.getValue(optJars)).split(",");
        for (String jar : result.jars) {
            if (!new File(jar).exists()) {
                printHelpAndExit("Jar file " + jar + " not found", options);
            }
        }
    }

    // search path directories
    if (cl.hasOption(optSearchPath)) {
        result.searchPath = ((String) cl.getValue(optSearchPath)).split(":");
        for (String dir : result.searchPath) {
            if (!new File(dir).exists() || !new File(dir).isDirectory()) {
                printHelpAndExit("Search-path entry " + dir + " not found or is no directory", options);
            }
        }
    }

    if (cl.hasOption(optBatch)) {
        result.batchMode = true;
        if (cl.hasOption(optOutOptions)) {
            String format = (String) cl.getValue(optOutOptions);
            try {
                result.outputAdapter = getOutputAdapter(format);
            } catch (Exception e) {
                printHelpAndExit(e,
                        "\"" + format + "\" is neither a valid output format nor a valid IO descriptor",
                        options);
            }
        }
    }

    // input
    if (cl.hasOption(optEval)) {
        String eval = (String) cl.getValue(optEval);
        if (!eval.endsWith(";"))
            eval += ";";
        result.addInputStream(new ByteArrayInputStream(eval.getBytes()));
    }
    if (cl.hasOption(optInputFiles)) {
        List<String> files = (List<String>) cl.getValues(optInputFiles);
        for (String file : files) {
            try {
                result.addInputStream(new FileInputStream(file));
            } catch (FileNotFoundException e) {
                printHelpAndExit(e, "Input file " + file + " not found", options);
            }
        }
    }

    // error log
    if (cl.hasOption(optLog)) {
        String path = (String) cl.getValue(optLog);
        try {
            BufferedJsonRecord logFD = new BufferedJsonRecord();
            logFD.add(Adapter.TYPE_NAME, new JsonString("local"));
            logFD.add(Adapter.LOCATION_NAME, new JsonString(path));
            OutputAdapter oa = (OutputAdapter) JaqlUtil.getAdapterStore().output.getAdapter(logFD);
            result.logAdapter = oa;
        } catch (Exception e) {
            printHelpAndExit(e, "\"" + path + "\" invalid", options);
        }
    }

    if (!result.batchMode) {
        result.addStdin();
    }

    return result;
}

From source file:com.tamingtext.tagrecommender.CountStackOverflowTags.java

public boolean parseArgs(String[] args) {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
    Option helpOpt = DefaultOptionCreator.helpOption();

    Option inputFileOpt = obuilder.withLongName("inputFile").withRequired(true)
            .withArgument(abuilder.withName("inputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The input file").withShortName("i").create();

    Option outputFileOpt = obuilder.withLongName("outputFile").withRequired(true)
            .withArgument(abuilder.withName("outputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The output file").withShortName("o").create();

    Option limitOpt = obuilder.withLongName("limit").withRequired(false)
            .withArgument(abuilder.withName("limit").withMinimum(1).withMaximum(1).create())
            .withDescription("Emit this many of the most frequent tags").withShortName("l").create();

    Option cutoffOpt = obuilder.withLongName("cutoff").withRequired(false)
            .withArgument(abuilder.withName("cutoff").withMinimum(1).withMaximum(1).create())
            .withDescription("Drop tags with a count less than this number").withShortName("c").create();

    Group group = gbuilder.withName("Options").withOption(inputFileOpt).withOption(outputFileOpt)
            .withOption(limitOpt).withOption(cutoffOpt).create();

    try {//from w ww. j  ava 2s . co  m
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption(helpOpt)) {
            CommandLineUtil.printHelp(group);
            return false;
        }

        inputFile = new File((String) cmdLine.getValue(inputFileOpt));
        countFile = new File((String) cmdLine.getValue(outputFileOpt));

        if (cmdLine.hasOption(limitOpt)) {
            limit = Integer.parseInt((String) cmdLine.getValue(limitOpt));
        }

        if (cmdLine.hasOption(cutoffOpt)) {
            cutoff = Integer.parseInt((String) cmdLine.getValue(cutoffOpt));
        }

    } catch (OptionException e) {
        log.error("Command-line option Exception", e);
        CommandLineUtil.printHelp(group);
        return false;
    }

    validate();
    return true;
}

From source file:egat.cli.strategyregret.StrategyRegretCommandHandler.java

@Override
protected void handleAdditionalChildOptions(CommandLine commandLine) throws CommandProcessingException {
    if (commandLine.hasOption(playerOption)) {
        playerId = (String) commandLine.getValue(playerOption);
    }/*from   w w w .  jav  a2s.  c  o m*/

    profilePath = (String) commandLine.getValue(profilePathOption);

    uniform = commandLine.hasOption(uniformOption);
}

From source file:com.tamingtext.tagrecommender.TestStackOverflowTagger.java

public boolean parseArgs(String[] args) {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
    Option helpOpt = DefaultOptionCreator.helpOption();

    Option inputFileOpt = obuilder.withLongName("inputFile").withRequired(true)
            .withArgument(abuilder.withName("inputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The input file").withShortName("i").create();

    Option countFileOpt = obuilder.withLongName("countFile").withRequired(true)
            .withArgument(abuilder.withName("countFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The tag count file").withShortName("c").create();

    Option outputFileOpt = obuilder.withLongName("outputFile").withRequired(true)
            .withArgument(abuilder.withName("outputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The output file").withShortName("c").create();

    Option solrUrlOpt = obuilder.withLongName("solrUrl").withRequired(true)
            .withArgument(abuilder.withName("solrUrl").withMinimum(1).withMaximum(1).create())
            .withDescription("URL of the solr server").withShortName("s").create();

    Group group = gbuilder.withName("Options").withOption(inputFileOpt).withOption(countFileOpt)
            .withOption(outputFileOpt).withOption(solrUrlOpt).create();

    try {/*from   www. j  av  a  2s.co  m*/
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption(helpOpt)) {
            CommandLineUtil.printHelp(group);
            return false;
        }

        inputFile = new File((String) cmdLine.getValue(inputFileOpt));
        countFile = new File((String) cmdLine.getValue(countFileOpt));
        outputFile = new File((String) cmdLine.getValue(outputFileOpt));
        solrUrl = (String) cmdLine.getValue(solrUrlOpt);
        client = new TagRecommenderClient(solrUrl);
    } catch (OptionException e) {
        log.error("Command-line option Exception", e);
        CommandLineUtil.printHelp(group);
        return false;
    } catch (MalformedURLException e) {
        log.error("MalformedURLException", e);
        return false;
    }

    validate();
    return true;
}

From source file:com.tamingtext.tagrecommender.ExtractStackOverflowData.java

public boolean parseArgs(String[] args) {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
    Option helpOpt = DefaultOptionCreator.helpOption();

    Option inputFileOpt = obuilder.withLongName("inputFile").withRequired(true)
            .withArgument(abuilder.withName("inputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The input file").withShortName("i").create();

    Option trainingOutputOpt = obuilder.withLongName("trainingOutputFile").withRequired(true)
            .withArgument(abuilder.withName("trainingOutputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The training data output file").withShortName("tr").create();

    Option testOutputOpt = obuilder.withLongName("testOutputFile").withRequired(true)
            .withArgument(abuilder.withName("testOutputFile").withMinimum(1).withMaximum(1).create())
            .withDescription("The test data output file").withShortName("te").create();

    Option trainingDataSizeOpt = obuilder.withLongName("trainingDataSize").withRequired(false)
            .withArgument(abuilder.withName("trainingDataSize").withMinimum(1).withMaximum(1).create())
            .withDescription("The number of questions to extract for training data").withShortName("trs")
            .create();/*w ww .  j av a2  s .com*/

    Option testDataSizeOpt = obuilder.withLongName("testDataSize").withRequired(false)
            .withArgument(abuilder.withName("testDataSize").withMinimum(1).withMaximum(1).create())
            .withDescription("The number of questions to extract for training data").withShortName("tes")
            .create();

    Group group = gbuilder.withName("Options").withOption(inputFileOpt).withOption(trainingOutputOpt)
            .withOption(testOutputOpt).withOption(trainingDataSizeOpt).withOption(testDataSizeOpt).create();

    try {
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption(helpOpt)) {
            CommandLineUtil.printHelp(group);
            return false;
        }

        inputFile = new File((String) cmdLine.getValue(inputFileOpt));
        trainingOutputFile = new File((String) cmdLine.getValue(trainingOutputOpt));
        testOutputFile = new File((String) cmdLine.getValue(testOutputOpt));

        if (cmdLine.hasOption(trainingDataSizeOpt)) {
            trainingDataSize = Integer.parseInt((String) cmdLine.getValue(trainingDataSizeOpt));
        }

        if (cmdLine.hasOption(testDataSizeOpt)) {
            testDataSize = Integer.parseInt((String) cmdLine.getValue(testDataSizeOpt));
        }

    } catch (OptionException e) {
        log.error("Command-line option Exception", e);
        CommandLineUtil.printHelp(group);
        return false;
    }

    validate();
    return true;
}

From source file:com.wsc.myexample.decisionForest.MyTestForest.java

public int init(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();

    Option inputOpt = DefaultOptionCreator.inputOption().create();

    Option datasetOpt = obuilder.withLongName("dataset").withShortName("ds").withRequired(true)
            .withArgument(abuilder.withName("dataset").withMinimum(1).withMaximum(1).create())
            .withDescription("Dataset path").create();

    Option modelOpt = obuilder.withLongName("model").withShortName("m").withRequired(true)
            .withArgument(abuilder.withName("path").withMinimum(1).withMaximum(1).create())
            .withDescription("Path to the Decision Forest").create();

    Option outputOpt = DefaultOptionCreator.outputOption().create();

    Option analyzeOpt = obuilder.withLongName("analyze").withShortName("a").withRequired(false).create();

    Option mrOpt = obuilder.withLongName("mapreduce").withShortName("mr").withRequired(false).create();

    Option helpOpt = DefaultOptionCreator.helpOption();

    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(datasetOpt).withOption(modelOpt)
            .withOption(outputOpt).withOption(analyzeOpt).withOption(mrOpt).withOption(helpOpt).create();

    try {//from   w w w.  jav  a 2s. com
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption("help")) {
            CommandLineUtil.printHelp(group);
            return -1;
        }

        String dataName = cmdLine.getValue(inputOpt).toString();
        String datasetName = cmdLine.getValue(datasetOpt).toString();
        String modelName = cmdLine.getValue(modelOpt).toString();
        String outputName = cmdLine.hasOption(outputOpt) ? cmdLine.getValue(outputOpt).toString() : null;
        analyze = cmdLine.hasOption(analyzeOpt);
        useMapreduce = cmdLine.hasOption(mrOpt);

        if (log.isDebugEnabled()) {
            log.debug("inout     : {}", dataName);
            log.debug("dataset   : {}", datasetName);
            log.debug("model     : {}", modelName);
            log.debug("output    : {}", outputName);
            log.debug("analyze   : {}", analyze);
            log.debug("mapreduce : {}", useMapreduce);
        }

        dataPath = dataName;
        datasetPath = datasetName;
        modelPath = modelName;
        if (outputName != null) {
            outputPath = outputName;
        }
    } catch (OptionException e) {
        log.warn(e.toString(), e);
        CommandLineUtil.printHelp(group);
        return -1;
    }

    testForest();

    return 0;
}

From source file:imageClassify.TestForest.java

@Override
public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();

    Option inputOpt = DefaultOptionCreator.inputOption().create();

    Option datasetOpt = obuilder.withLongName("dataset").withShortName("ds").withRequired(true)
            .withArgument(abuilder.withName("dataset").withMinimum(1).withMaximum(1).create())
            .withDescription("Dataset path").create();

    Option modelOpt = obuilder.withLongName("model").withShortName("m").withRequired(true)
            .withArgument(abuilder.withName("path").withMinimum(1).withMaximum(1).create())
            .withDescription("Path to the Decision Forest").create();

    Option outputOpt = DefaultOptionCreator.outputOption().create();

    Option analyzeOpt = obuilder.withLongName("analyze").withShortName("a").withRequired(false).create();

    Option mrOpt = obuilder.withLongName("mapreduce").withShortName("mr").withRequired(false).create();

    Option helpOpt = DefaultOptionCreator.helpOption();

    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(datasetOpt).withOption(modelOpt)
            .withOption(outputOpt).withOption(analyzeOpt).withOption(mrOpt).withOption(helpOpt).create();

    try {//from   ww w .  ja  va 2s.  c  o  m
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption("help")) {
            CommandLineUtil.printHelp(group);
            return -1;
        }

        String dataName = cmdLine.getValue(inputOpt).toString();
        String datasetName = cmdLine.getValue(datasetOpt).toString();
        String modelName = cmdLine.getValue(modelOpt).toString();
        String outputName = cmdLine.hasOption(outputOpt) ? cmdLine.getValue(outputOpt).toString() : null;
        analyze = cmdLine.hasOption(analyzeOpt);
        useMapreduce = cmdLine.hasOption(mrOpt);

        if (log.isDebugEnabled()) {
            log.debug("inout     : {}", dataName);
            log.debug("dataset   : {}", datasetName);
            log.debug("model     : {}", modelName);
            log.debug("output    : {}", outputName);
            log.debug("analyze   : {}", analyze);
            log.debug("mapreduce : {}", useMapreduce);
        }

        dataPath = new Path(dataName);
        datasetPath = new Path(datasetName);
        modelPath = new Path(modelName);
        if (outputName != null) {
            outputPath = new Path(outputName);
        }
    } catch (OptionException e) {
        log.warn(e.toString(), e);
        CommandLineUtil.printHelp(group);
        return -1;
    }

    testForest();

    return 0;
}

From source file:com.wsc.myexample.decisionForest.MyBuildForest.java

public int init(String[] args) throws IOException, ClassNotFoundException, InterruptedException,
        InstantiationException, IllegalAccessException {

    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();

    Option dataOpt = obuilder.withLongName("data").withShortName("d").withRequired(true)
            .withArgument(abuilder.withName("path").withMinimum(1).withMaximum(1).create())
            .withDescription("Data path").create();

    Option datasetOpt = obuilder.withLongName("dataset").withShortName("ds").withRequired(true)
            .withArgument(abuilder.withName("dataset").withMinimum(1).withMaximum(1).create())
            .withDescription("Dataset path").create();

    Option selectionOpt = obuilder.withLongName("selection").withShortName("sl").withRequired(false)
            .withArgument(abuilder.withName("m").withMinimum(1).withMaximum(1).create())
            .withDescription("Optional, Number of variables to select randomly at each tree-node.\n"
                    + "For classification problem, the default is square root of the number of explanatory variables.\n"
                    + "For regression problem, the default is 1/3 of the number of explanatory variables.")
            .create();/*w  w  w .  ja v a 2  s  .com*/

    Option noCompleteOpt = obuilder.withLongName("no-complete").withShortName("nc").withRequired(false)
            .withDescription("Optional, The tree is not complemented").create();

    Option minSplitOpt = obuilder.withLongName("minsplit").withShortName("ms").withRequired(false)
            .withArgument(abuilder.withName("minsplit").withMinimum(1).withMaximum(1).create())
            .withDescription("Optional, The tree-node is not divided, if the branching data size is "
                    + "smaller than this value.\nThe default is 2.")
            .create();

    Option minPropOpt = obuilder.withLongName("minprop").withShortName("mp").withRequired(false)
            .withArgument(abuilder.withName("minprop").withMinimum(1).withMaximum(1).create())
            .withDescription("Optional, The tree-node is not divided, if the proportion of the "
                    + "variance of branching data is smaller than this value.\n"
                    + "In the case of a regression problem, this value is used. "
                    + "The default is 1/1000(0.001).")
            .create();

    Option seedOpt = obuilder.withLongName("seed").withShortName("sd").withRequired(false)
            .withArgument(abuilder.withName("seed").withMinimum(1).withMaximum(1).create())
            .withDescription("Optional, seed value used to initialise the Random number generator").create();

    Option partialOpt = obuilder.withLongName("partial").withShortName("p").withRequired(false)
            .withDescription("Optional, use the Partial Data implementation").create();

    Option nbtreesOpt = obuilder.withLongName("nbtrees").withShortName("t").withRequired(true)
            .withArgument(abuilder.withName("nbtrees").withMinimum(1).withMaximum(1).create())
            .withDescription("Number of trees to grow").create();

    Option outputOpt = obuilder.withLongName("output").withShortName("o").withRequired(true)
            .withArgument(abuilder.withName("path").withMinimum(1).withMaximum(1).create())
            .withDescription("Output path, will contain the Decision Forest").create();

    Option helpOpt = obuilder.withLongName("help").withShortName("h").withDescription("Print out help")
            .create();

    Group group = gbuilder.withName("Options").withOption(dataOpt).withOption(datasetOpt)
            .withOption(selectionOpt).withOption(noCompleteOpt).withOption(minSplitOpt).withOption(minPropOpt)
            .withOption(seedOpt).withOption(partialOpt).withOption(nbtreesOpt).withOption(outputOpt)
            .withOption(helpOpt).create();

    try {
        Parser parser = new Parser();
        parser.setGroup(group);
        CommandLine cmdLine = parser.parse(args);

        if (cmdLine.hasOption("help")) {
            CommandLineUtil.printHelp(group);
            return -1;
        }

        isPartial = cmdLine.hasOption(partialOpt);
        String dataName = cmdLine.getValue(dataOpt).toString();
        String datasetName = cmdLine.getValue(datasetOpt).toString();
        String outputName = cmdLine.getValue(outputOpt).toString();
        nbTrees = Integer.parseInt(cmdLine.getValue(nbtreesOpt).toString());

        if (cmdLine.hasOption(selectionOpt)) {
            m = Integer.parseInt(cmdLine.getValue(selectionOpt).toString());
        }
        complemented = !cmdLine.hasOption(noCompleteOpt);
        if (cmdLine.hasOption(minSplitOpt)) {
            minSplitNum = Integer.parseInt(cmdLine.getValue(minSplitOpt).toString());
        }
        if (cmdLine.hasOption(minPropOpt)) {
            minVarianceProportion = Double.parseDouble(cmdLine.getValue(minPropOpt).toString());
        }
        if (cmdLine.hasOption(seedOpt)) {
            seed = Long.valueOf(cmdLine.getValue(seedOpt).toString());
        }

        if (log.isDebugEnabled()) {
            log.debug("data : {}", dataName);
            log.debug("dataset : {}", datasetName);
            log.debug("output : {}", outputName);
            log.debug("m : {}", m);
            log.debug("complemented : {}", complemented);
            log.debug("minSplitNum : {}", minSplitNum);
            log.debug("minVarianceProportion : {}", minVarianceProportion);
            log.debug("seed : {}", seed);
            log.debug("nbtrees : {}", nbTrees);
            log.debug("isPartial : {}", isPartial);
        }

        dataPath = dataName;
        datasetPath = datasetName;
        outputPath = outputName;

    } catch (OptionException e) {
        log.error("Exception", e);
        CommandLineUtil.printHelp(group);
        return -1;
    }

    buildForest();

    return 0;
}