private static bool isOptionNameMatch(Option opt, string token, bool useShort) { if (useShort) { return opt.ShortName != null && StringUtils.EqualsIgnoreCase(opt.ShortName, token); } return StringUtils.EqualsIgnoreCase(opt.Name, token); }
private static bool SkipOption(Iterator<string> iter, Option opt) { Type type = opt.Target.FieldType; if (type.IsArray) { Array arr = (Array) opt.Target.GetValue(opt); if (arr != null) { int index; int length = arr.Length; for (index = 0; index < length && iter.HasNext(); ++index) { string value = iter.Next(); if (!IsValidOptionString(value)) { return false; } } return index == length; } return false; } if (type == typeof(int) || type == typeof(float) || type == typeof(string)) { if (iter.HasNext()) { string value = iter.Next(); return IsValidOptionString(value); } return false; } if (type == typeof(bool)) { return true; } return false; }
private static string getSuggestedOption(Option opt, bool useShort) { if (useShort) { return StringUtils.C("-" + opt.ShortName, ColorCode.TableVar); } return StringUtils.C("--" + opt.Name, ColorCode.TableVar); }