List of usage examples for org.apache.commons.cli CommandLine getOptionValues
public String[] getOptionValues(char opt)
From source file:net.kahowell.xsd.fuzzer.XmlGenerator.java
private static void doPostModuleConfig(CommandLine commandLine, XmlGenerationOptions options, Injector injector) {/* ww w .j av a 2 s.co m*/ if (commandLine.hasOption("s")) { String[] strategies = commandLine.getOptionValues("s"); for (String strategy : strategies) { options.getStrategies().add(Strategy.valueOf(strategy)); } } if (injector.getInstance(Key.get(Boolean.class, Names.named("offline")))) { XmlOptions schemaOptions = injector .getInstance(Key.get(XmlOptions.class, Names.named("xml schema options"))); schemaOptions.remove(XmlOptions.COMPILE_DOWNLOAD_URLS); } }
From source file:de.topobyte.utilities.apache.commons.cli.parsing.ArgumentHelper.java
public static List<BooleanOption> getBooleans(CommandLine line, String option) throws ArgumentParseException { String[] values = line.getOptionValues(option); if (values == null) { return new ArrayList<>(); }/*from ww w.j av a 2 s . c o m*/ List<BooleanOption> options = new ArrayList<>(); for (String value : values) { boolean bool = parseBoolean(value); options.add(new BooleanOption(true, bool)); } return options; }
From source file:de.topobyte.utilities.apache.commons.cli.parsing.ArgumentHelper.java
public static List<IntegerOption> getIntegers(CommandLine line, String option) throws ArgumentParseException { String[] values = line.getOptionValues(option); if (values == null) { return new ArrayList<>(); }//from ww w. jav a2 s . co m List<IntegerOption> options = new ArrayList<>(); for (String value : values) { int num = parseInteger(value); options.add(new IntegerOption(true, num)); } return options; }
From source file:de.topobyte.utilities.apache.commons.cli.parsing.ArgumentHelper.java
public static List<LongOption> getLongs(CommandLine line, String option) throws ArgumentParseException { String[] values = line.getOptionValues(option); if (values == null) { return new ArrayList<>(); }/*from w w w . j a v a2 s . c om*/ List<LongOption> options = new ArrayList<>(); for (String value : values) { long num = parseLong(value); options.add(new LongOption(true, num)); } return options; }
From source file:de.topobyte.utilities.apache.commons.cli.parsing.ArgumentHelper.java
public static List<DoubleOption> getDoubles(CommandLine line, String option) throws ArgumentParseException { String[] values = line.getOptionValues(option); if (values == null) { return new ArrayList<>(); }// ww w. j av a 2 s . c om List<DoubleOption> options = new ArrayList<>(); for (String value : values) { Double num = parseDouble(value); options.add(new DoubleOption(true, num)); } return options; }
From source file:edu.kit.checkstyle.Main.java
/** * Determines the files to process./*from w ww . ja v a 2s.co m*/ * * @param aLine the command line options specifying what files to process * @return list of files to process */ private static List<File> getFilesToProcess(CommandLine aLine) { final List<File> files = Lists.newLinkedList(); if (aLine.hasOption("r")) { final String[] values = aLine.getOptionValues("r"); for (String element : values) { traverse(new File(element), files); } } final String[] remainingArgs = aLine.getArgs(); for (String element : remainingArgs) { files.add(new File(element)); } return files; }
From source file:lee.util.jtap.JTapCli.java
protected static HashMap<String, String> getMappedArgs(CommandLine cmd, String... argNames) { HashMap<String, String> argMap = new HashMap<String, String>(); String[] optArgs = cmd.getOptionValues("s"); for (int a = 0; a < optArgs.length; a++) { argMap.put(argNames[a], optArgs[a]); }/*from www.j a v a 2s . c o m*/ return argMap; }
From source file:jp.primecloud.auto.tool.management.main.SQLMain.java
public static void updateExecutePrepared(CommandLine commandLine) { String sql = commandLine.getOptionValue("sql"); SQLExecuter sqlExecuter = new SQLExecuterFactory().createPCCSQLExecuter(); String[] params = commandLine.getOptionValues("prepared"); try {/*from w w w . j a va 2s .c om*/ sqlExecuter.executePrepared(sql, params); } catch (Exception e) { log.error("[" + sql + "] ??????", e); System.out.println("[" + sql + "] ??????"); return; } }
From source file:Inmemantlr.java
private static Set<File> getFilesForOption(CommandLine cmd, String opt) { Set<File> ret = new HashSet<>(); if (cmd.hasOption(opt)) { Set<String> us = new HashSet<>(); us.addAll(Arrays.asList(cmd.getOptionValues(opt))); ret.addAll(us.stream().map(File::new).collect(Collectors.toSet())); }//from ww w . j av a 2 s . c o m return ret; }
From source file:gobblin.util.limiter.stressTest.StressTestUtils.java
/** * Add configurations provided with {@link #CONFIG_OPT} to {@link Configuration}. *///ww w .j a v a 2 s. co m public static void populateConfigFromCli(Configuration configuration, CommandLine cli) { String stressorClass = cli.getOptionValue(STRESSOR_OPT.getOpt(), DEFAULT_STRESSOR_CLASS.getName()); configuration.set(STRESSOR_CLASS, stressorClass); if (cli.hasOption(CONFIG_OPT.getOpt())) { for (String arg : cli.getOptionValues(CONFIG_OPT.getOpt())) { List<String> tokens = Splitter.on(":").limit(2).splitToList(arg); if (tokens.size() < 2) { throw new IllegalArgumentException("Configurations must be of the form <key>:<value>"); } configuration.set(tokens.get(0), tokens.get(1)); } } }