/** * @param name The name of the option * @return the {@link org.apache.commons.cli2.Option} with the name, else null */ protected Option getCLIOption(String name) { for (Option option : options) { if (option.getPreferredName().equals(name)) { return option; } } return null; }
public boolean hasName(String name) { return getCommand().getTriggers().contains(name); }
final List helpLines = option.helpLines( skipToplevel ? -1 : 0, getDisplaySettings(), getComparator()); if (skipToplevel) {
/** * @param name The name of the option * @return the {@link org.apache.commons.cli2.Option} with the name, else null */ protected Option getCLIOption(String name) { for (Option option : options) { if (option.getPreferredName().equals(name)) { return option; } } return null; }
/** * @param name The name of the option * @return the {@link org.apache.commons.cli2.Option} with the name, else null */ protected Option getCLIOption(String name) { for (Option option : options) { if (option.getPreferredName().equals(name)) { return option; } } return null; }
public String getName() { return getCommand().getPreferredName(); }
protected static void maybePut(Map<String, List<String>> args, CommandLine cmdLine, Option... opt) { for (Option o : opt) { // the option appeared on the command-line, or it has a value // (which is likely a default value). if (cmdLine.hasOption(o) || cmdLine.getValue(o) != null || (cmdLine.getValues(o) != null && !cmdLine.getValues(o).isEmpty())) { // nulls are ok, for cases where options are simple flags. List<?> vo = cmdLine.getValues(o); if (vo != null && !vo.isEmpty()) { List<String> vals = Lists.newArrayList(); for (Object o1 : vo) { vals.add(o1.toString()); } args.put(o.getPreferredName(), vals); } else { args.put(o.getPreferredName(), null); } } } }
protected static void maybePut(Map<String, List<String>> args, CommandLine cmdLine, Option... opt) { for (Option o : opt) { // the option appeared on the command-line, or it has a value // (which is likely a default value). if (cmdLine.hasOption(o) || cmdLine.getValue(o) != null || (cmdLine.getValues(o) != null && !cmdLine.getValues(o).isEmpty())) { // nulls are ok, for cases where options are simple flags. List<?> vo = cmdLine.getValues(o); if (vo != null && !vo.isEmpty()) { List<String> vals = Lists.newArrayList(); for (Object o1 : vo) { vals.add(o1.toString()); } args.put(o.getPreferredName(), vals); } else { args.put(o.getPreferredName(), null); } } } }
protected static void maybePut(Map<String, List<String>> args, CommandLine cmdLine, Option... opt) { for (Option o : opt) { // the option appeared on the command-line, or it has a value // (which is likely a default value). if (cmdLine.hasOption(o) || cmdLine.getValue(o) != null || (cmdLine.getValues(o) != null && !cmdLine.getValues(o).isEmpty())) { // nulls are ok, for cases where options are simple flags. List<?> vo = cmdLine.getValues(o); if (vo != null && !vo.isEmpty()) { List<String> vals = new ArrayList<>(); for (Object o1 : vo) { vals.add(o1.toString()); } args.put(o.getPreferredName(), vals); } else { args.put(o.getPreferredName(), null); } } } }