use of de.carne.util.cmdline.CmdLineProcessor in project certmgr by hdecarne.
the class CertMgrApplication method evalCmdLine.
@Nullable
private File evalCmdLine() {
CmdLineProcessor cmdLine = new CmdLineProcessor("certmgr", getParameters().getRaw());
List<String> defaultArgs = new ArrayList<>();
cmdLine.onSwitch((s) -> applyLogConfig(Logs.CONFIG_VERBOSE)).arg("--verbose");
cmdLine.onSwitch((s) -> applyLogConfig(Logs.CONFIG_DEBUG)).arg("--debug");
cmdLine.onUnnamedOption((s) -> defaultArgs.add(s));
try {
cmdLine.process();
LOG.info("Running command line ''{0}''", cmdLine);
} catch (CmdLineException e) {
LOG.warning(e, "Invalid command line ''{0}''; ", cmdLine);
}
File defaultStoreHome = null;
for (String defaultArg : defaultArgs) {
if (defaultStoreHome == null) {
defaultStoreHome = new File(defaultArg);
} else {
LOG.warning("Ignoring extra store home argument ''{0}''", defaultStoreHome);
}
}
return defaultStoreHome;
}
Aggregations