Retrieve the {@link Option} matching the long or short name specified.
The leading hyphens in the name are ignored (up to 2).

@param opt short or long name of the {@link Option}
@return the option represented by opt
768376
public Option getOption(String opt)
    {
        opt = Util.stripLeadingHyphens(opt);

        if (shortOpts.containsKey(opt))
        {
            return shortOpts.get(opt);
        }

        return longOpts.get(opt);
    }
1033172
public static CreateOptions getOpt(Class<? extends CreateOptions> theClass, CreateOptions... opts) {
    if (opts == null)
      return null;
    CreateOptions result = null;
    for (int i = 0; i < opts.length; ++i) {
      if (opts[i].getClass() == theClass) {
        if (result != null)
          throw new IllegalArgumentException("Multiple args with type " + theClass);
        result = opts[i];
      }
    }
    return result;
  }
1158097
public Object getPreparedClassOption(ClassOption opt) {
        if (this.classOptionNamesToPreparedObjects == null) {
                    this.prepareForUse();
                }
        return this.classOptionNamesToPreparedObjects.get(opt.getName());
    }
270456
public static String getOptionValue(String[] args, String optionName) {
		String opt = "-" + optionName + "=";
		for (String arg : args) {
			if (arg.startsWith(opt))
				return arg.substring(opt.length());
		}
		return null;
	}
227187
private boolean isShortOption(String token) {
        // short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
        if (!token.startsWith("-") || token.length() == 1) {
            return false;
        }
        // remove leading "-" and "=value"
        int pos = token.indexOf("=");
        String name = (pos == -1 ? token.substring(1) : token.substring(1, pos));
        if (options.hasShortOption(name)) {
            return true;
        }
        // check for several concatenated short options
        return (name.length() > 0 && options.hasShortOption(String.valueOf(name.charAt(0))));
    }
942944
def get_option_default(self, opt_name):
        
        if not self.has_option(opt_name):
            raise ValueError("Unknow option name (%s)" % opt_name)
        return self._options[opt_name].default
468300
public String readName() {
    String optionName;
    char c = peekChar();
    if (c == '(') {
      pos++;
      optionName = readWord();
      if (readChar() != ')') throw unexpected("expected ')'");
    } else if (c == '[') {
      pos++;
      optionName = readWord();
      if (readChar() != ']') throw unexpected("expected ']'");
    } else {
      optionName = readWord();
    }
    return optionName;
  }
526491
@SuppressWarnings("unchecked")
    public List<String> getOptionValues(final String optionName) {
        if (optionName.length() == 1) {
            return getOptionValues(optionName.charAt(0));
        }

        return commandLine.getValues("--" + optionName);
    }
516898
private boolean isLongOption(String token)
    {
        if (!token.startsWith("-") || token.length() == 1)
        {
            return false;
        }

        int pos = token.indexOf("=");
        String t = pos == -1 ? token : token.substring(0, pos);

        if (!options.getMatchingOptions(t).isEmpty())
        {
            // long or partial long options (--L, -L, --L=V, -L=V, --l, --l=V)
            return true;
        }
        else if (getLongPrefix(token) != null && !token.startsWith("--"))
        {
            // -LV
            return true;
        }

        return false;
    }
350504
public String optString(String name, String fallback) {
        return optString(name, fallback, true);
    }
818786
private String getAndAddUniqueShortName(String name) {
        // Capitalize the first letter of the name.
        String initCappedName = name.substring(0, 1).toUpperCase() + name.substring(1, name.length());
        // Make the short name all the capital letters in the long name.
        Matcher matcher = capitals.matcher(initCappedName);
        StringBuilder sbShortName = new StringBuilder();
        while(matcher.find()) {
            sbShortName.append(matcher.group());
        }
        String shortName = sbShortName.toString().toLowerCase();

        if (!shortNames.add(shortName)) {
            int i;
            for (i=0; i<10; i++) {
                String tmpsn = shortName + i;
                if (shortNames.add(tmpsn)) {
                    shortName = tmpsn;
                    break;
                }
            }
            if (i == 10) {
                throw new RuntimeException("Multiple options have the same short name: -" + shortName  + " (--" + name + ")");
            }
        }
        return shortName;
    }
1351568
private OptionHandler findOptionByName(String name) {
		for (OptionHandler h : options) {
			NamedOptionDef option = (NamedOptionDef)h.option;
			if (name.equals(option.name())) {
				return h;
			}
			for (String alias : option.aliases()) {
				if (name.equals(alias)) {
					return h;
				}
			}
		}
		return null;
	}
1248131
@SuppressWarnings("ReturnOfNull")
    public static Option strToOpt(final String optStr) {
        final String[] parts = SPACE.split(optStr, 2);
        final String name = parts[0];
        final String param = 1 < parts.length ? parts[1] : null;

        final Option opt = OPTS.get(name);
        return opt == null ? null : opt.newInstance(param);
    }
1153404
public @NotNull OptionalLong findOptionalLong(@NotNull @SQL String sql, Object... args) {
        return findOptionalLong(SqlQuery.query(sql, args));
    }
110941
public boolean hasShortOption(String opt)
    {
        opt = Util.stripLeadingHyphens(opt);

        return shortOpts.containsKey(opt);
    }
399592
public Long optLong(String name, Long fallback) {
        return optLong(name, fallback, true);
    }
16009
public Option getOptionWithShortForm( String shortForm ) throws InvalidOptionException
    {
        for (Option option : options)
        {
            if (shortForm.equals( option.getShortForm() )) return option;
        }

        throw new InvalidOptionException( shortForm );
    }