private void createOptions() { uOption.buildHelp(); uOption.buildDebug(); uOption.buildConfig(); oScan = Option.builder("tag").required(false).desc("Scan the MP4 Library").build(); uOption.getOptions().addOption(oScan); }
public static void main(String args[]) throws Exception { JaxbUtil.setNsPrefixMapper(new OtrCastNsPrefixMapper()); UtilsCliOption uOption = new UtilsCliOption( de.kisner.otrcast.api.Version.class.getPackage().getImplementationVersion()); uOption.setLog4jPaths("otrcast-app/config"); OtrCastClient otrMc = new OtrCastClient(uOption); try { otrMc.parseArguments(args); } catch (ParseException e) { logger.error(e.getMessage()); uOption.help(); } catch (OtrConfigurationException e) { logger.error(e.getMessage()); uOption.help(); } catch (UtilsProcessingException e) { e.printStackTrace(); } }
public void parseArguments(String args[]) throws Exception { createOptions(); CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(uOption.getOptions(), args); uOption.handleHelp(cmd); uOption.handleLogger(cmd); otrConfig.readConfig(uOption.initConfig(cmd, OtrCastBootstrap.xmlConfig)); otrConfig.checkMcSettings(); if (cmd.hasOption(oScan.getOpt()) && uOption.allowAppStart()) { scanMediathek(otrConfig.getDir(OtrConfig.Dir.MC)); } if (!uOption.isAppStarted()) { uOption.help(); } }