private CommandLineOption GetOptionOrNull(string name) { name = CommandLineOption.Normalize(name); if (!_options.TryGetValue(name, out var result)) { return(null); } return(result); }
private CommandLineOption GetOptionOrNull(char ch) { var name = CommandLineOption.Normalize(ch); if (!_options.TryGetValue(name, out var result)) { return(null); } return(result); }
private void ValidateAndAddOption(CommandLineOption option, int i) { if (option.LongName != null) { Debug.Assert(!string.IsNullOrWhiteSpace(option.LongName)); if (_options.TryGetValue(option.LongName, out _)) { throw new ArgumentException($"INTERNAL ERROR: options[{i}] is {option.LongName}, which was specified before."); } _options[option.LongName] = option; } if (option.ShortName != null) { Debug.Assert(!string.IsNullOrWhiteSpace(option.ShortName)); if (_options.TryGetValue(option.ShortName, out _)) { throw new ArgumentException($"INTERNAL ERROR: options[{i}] is {option.ShortName}, which was specified before."); } _options[option.ShortName] = option; } }
private void AddCharOption(ICollection <CommandLineArgument> result, CommandLineOption option, int argIndex, string arg, int charIndex, string value) { result.Add(new CommandLineArgument(this, option, argIndex, arg, charIndex, value)); }