public string GetOption(CliOption o) { if (o == null) { throw new ArgumentNullException("o"); } return(GetOption(o.DefaultValue, o.Names)); }
public bool HasOption(CliOption opt) { if (opt == null) { throw new ArgumentNullException("opt"); } return(HasOption(opt.Names)); }
static string LeftOf(CliOption opt) { string l = string.Format("/{0}", opt.Name); if (!string.IsNullOrEmpty(opt.Format)) { l += ":" + opt.Format; } return(l); }
public bool IsMinus(CliOption opt) { if (opt == null) { throw new ArgumentNullException("opt"); } if (!opt.PlusMinus) { throw new ArgumentException( string.Format("Option {0} has no [+|-] format", opt.Name), "opt"); } foreach (var item in Options) { string name = item.Name; if (opt.CheckName(name, true)) { int nn = name.Length; if (name[nn - 1] == '+') { return(false); } if (name[nn - 1] == '-') { return(true); } if (!ParseBool(item.Value, true)) { return(true); } } } return(false); }