private static Map<?, ?> parseArgs(String[] args) { Map<?, ?> params = null; try { ArgumentParser parser = new ArgumentParser( "-f[s{=HttpJmxAgent.xml}] " + "-jmxPort[i{=8080}] " + "-rmiPort[i{=" + Registry.REGISTRY_PORT + "}]" , "" ); params = parser.parse(args); } catch (ParseException e) { throw new IllegalArgumentException(e); } return params; }
private String options(int indentation, String prefix, String command) { StringBuffer buf = new StringBuffer(); String[] format = selectFormat(command); if (format == null) { return ""; } ArgumentParser p = new ArgumentParser(format[0], format[1]); Map<String, ArgumentFormat> options = p.getOptionFormat(); SortedMap<String, ArgumentFormat> soptions = new TreeMap<String, ArgumentFormat>(options); optionDetailList(indentation, prefix, buf, soptions); return buf.toString(); }
private String optionList(int indentation, String prefix, String command) { if (prefix != null) { return ""; } StringBuilder buf = new StringBuilder(); String[] format = selectFormat(command); if (format == null) { return ""; } ArgumentParser p = new ArgumentParser(format[0], format[1]); Map<String, ArgumentFormat> options = p.getOptionFormat(); SortedMap<String, ArgumentFormat> soptions = new TreeMap<>(options); for (Iterator<String> it = soptions.keySet().iterator(); it.hasNext(); ) { String opt = it.next(); buf.append("-").append(opt); if (it.hasNext()) { buf.append(", "); } } return format(indentation, buf.toString(), 0, 0); }
= new ArgumentParser(optsBuilder.toString(), paramsBuilder.toString()); params = parser.parse(args);
ArgumentParser parser = new ArgumentParser(optsBuilder.toString(), ""); params = parser.parse(args);
new ArgumentParser(System.getProperty("org.snmp4j.OptionFormat", "-o1[i{parameter1}] -o2[s,l]"), System.getProperty("org.snmp4j.ParameterFormat",
new ArgumentParser(optionFormat, "#command[s] +following[s] .."); Map params = ap.parse(args); String command = (String) ArgumentParser.getValue(params, "command", 0);
new ArgumentParser(System.getProperty("org.snmp4j.OptionFormat", "-o1[i{parameter1}] -o2[s,l]"), System.getProperty("org.snmp4j.ParameterFormat",
new ArgumentParser(System.getProperty("org.snmp4j.OptionFormat", "-o1[i{parameter1}] -o2[s,l]"), System.getProperty("org.snmp4j.ParameterFormat",
ArgumentParser parser = new ArgumentParser(optsBuilder.toString(), ""); params = parser.parse(args);
throws ParseException { ArgumentParser ap = new ArgumentParser(optionFormat, "#command[s] +following[s] .."); Map<String,List<Object>> params = ap.parse(args); String command = (String) ArgumentParser.getValue(params, "command", 0);
public static void main(String[] args) { try { String[] commandSet = ArgumentParser.selectCommand(args, OPTIONS, COMMANDS); if (commandSet == null) { printUsage(); System.exit(2); } ArgumentParser parser = new ArgumentParser(commandSet[1], commandSet[2]); Map<String,List<Object>> commandLineParameters = parser.parse(args); LogControl logcontrol = new LogControl(commandLineParameters); logcontrol.run(); } catch (ParseException pex) { System.out.println(pex.getMessage()); System.exit(1); } }
public static void main(String[] args) { try { String[] commandSet = ArgumentParser.selectCommand(args, OPTIONS, COMMANDS); if (commandSet == null) { printUsage(); System.exit(2); } ArgumentParser parser = new ArgumentParser(commandSet[1], commandSet[2]); Map commandLineParameters = parser.parse(args); LogControl logcontrol = new LogControl(commandLineParameters); logcontrol.run(); } catch (ParseException pex) { System.out.println(pex.getMessage()); System.exit(1); } }
new ArgumentParser(optionFormat, "#command[s] +following[s] .."); Map params = ap.parse(args); String command = (String) ArgumentParser.getValue(params, "command", 0);
public static void main(String[] args) { try { String[] commandSet = ArgumentParser.selectCommand(args, OPTIONS, COMMANDS); if (commandSet == null) { printUsage(); System.exit(2); } ArgumentParser parser = new ArgumentParser(commandSet[1], commandSet[2]); Map commandLineParameters = parser.parse(args); LogControl logcontrol = new LogControl(commandLineParameters); logcontrol.run(); } catch (ParseException pex) { System.out.println(pex.getMessage()); System.exit(1); } }
String c = stringEntry.getKey(); String[] format = stringEntry.getValue(); ArgumentParser p = new ArgumentParser(format[0], format[1]); Map<String, ArgumentFormat> o = p.getOptionFormat(); options.putAll(o);
new ArgumentParser(commandSet[1], commandSet[2]); commandLineParameters = parser.parse(args); String command =
new ArgumentParser("-c[s{=SampleAgent.cfg}] -bc[s{=SampleAgent.bc}] +dhks[s] "+ "+ts[s] +cfg[s] +tls-version[s{=TLSv1}<TLSv1[\\.1|\\.2]?[,TLSv1[\\.1|\\.2]?]*>] ", "#address[s<(udp|tcp|tls|dtls):.*[/[0-9]+]?>] ..");
new ArgumentParser("-c[s{=SampleAgent.cfg}] -bc[s{=SampleAgent.bc}] "+ "+ts[s] +cfg[s]", "#address[s<(udp|tcp):.*[/[0-9]+]?>] ..");