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);
}
}
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)));
}
}
Aggregations