internal void AddOption(Option option) { if (_shortNameLookup.ContainsKey(option.ShortName)) throw new DuplicateOptionException(); if (_longNameLookup.ContainsKey(option.LongName)) throw new DuplicateOptionException(); _options.Add(option); _shortNameLookup.Add(option.ShortName, option); _longNameLookup.Add(option.LongName, option); }
public Slop Option(char shortName, string longName, string description, object defaultValue = null, bool required = false, Action<string> callback = null) { var option = new Option { ShortName = shortName, LongName = longName, Description = description, Default = defaultValue, IsRequired = required, Callback = callback }; AddOption(option); return this; }