Search in sources :

Example 1 with CmdlineParser

use of de.tototec.cmdoption.CmdlineParser in project java_study by aloyschen.

the class GbdtAndLr method main.

public static void main(String[] args) {
    GbdtConfig config = new GbdtConfig();
    CmdlineParser cp = new CmdlineParser(config);
    cp.setProgramName("GBDT+LR train");
    cp.parse(args);
    if (config.help) {
        cp.usage();
        System.exit(0);
    }
    if (config.maxDepth == null || config.maxIter == null || config.dataFile == null) {
        System.out.println("参数格式错误");
        System.exit(0);
    } else {
        GbdtAndLr gbdt_lr = new GbdtAndLr(config.maxDepth, config.maxIter, config.modelPath);
        gbdt_lr.train(config.dataFile);
    }
}
Also used : CmdlineParser(de.tototec.cmdoption.CmdlineParser)

Example 2 with CmdlineParser

use of de.tototec.cmdoption.CmdlineParser in project semantic-versioning by jeluard.

the class Main method main.

public static void main(final String[] args) throws IOException {
    Config config = new Config();
    CmdlineParser cmdlineParser = new CmdlineParser(config);
    // Load translations of command line descriptions
    cmdlineParser.setResourceBundle(Main.class.getPackage().getName() + ".Messages", Main.class.getClassLoader());
    cmdlineParser.setProgramName("semver");
    cmdlineParser.setAboutLine("Semantic Version validator.");
    try {
        cmdlineParser.parse(args);
    } catch (CmdlineParserException e) {
        System.err.println("Error: " + e.getLocalizedMessage() + "\nRun semver --help for help.");
        System.exit(1);
    }
    if (config.help) {
        cmdlineParser.usage();
        System.exit(0);
    }
    final DiffCriteria diffCriteria = config.publicOnly ? new PublicDiffCriteria() : new SimpleDiffCriteria();
    final Comparer comparer = new Comparer(diffCriteria, new File(config.baseJar), new File(config.newJar), config.includes, config.excludes);
    final Delta delta = comparer.diff();
    if (config.diff) {
        Dumper.dump(delta);
    }
    if (config.check) {
        System.out.println(delta.computeCompatibilityType());
    }
    if (config.infer) {
        System.out.println(delta.infer(Version.parse(config.baseVersion)));
    }
    if (config.validate) {
        System.out.println(delta.validate(Version.parse(config.baseVersion), Version.parse(config.newVersion)));
    }
}
Also used : PublicDiffCriteria(org.osjava.jardiff.PublicDiffCriteria) CmdlineParser(de.tototec.cmdoption.CmdlineParser) CmdlineParserException(de.tototec.cmdoption.CmdlineParserException) SimpleDiffCriteria(org.osjava.jardiff.SimpleDiffCriteria) SimpleDiffCriteria(org.osjava.jardiff.SimpleDiffCriteria) PublicDiffCriteria(org.osjava.jardiff.PublicDiffCriteria) DiffCriteria(org.osjava.jardiff.DiffCriteria) File(java.io.File)

Aggregations

CmdlineParser (de.tototec.cmdoption.CmdlineParser)2 CmdlineParserException (de.tototec.cmdoption.CmdlineParserException)1 File (java.io.File)1 DiffCriteria (org.osjava.jardiff.DiffCriteria)1 PublicDiffCriteria (org.osjava.jardiff.PublicDiffCriteria)1 SimpleDiffCriteria (org.osjava.jardiff.SimpleDiffCriteria)1