private static void BuildAndSetPostParsingStateIfNeeded(object options, OptionInfo option, bool? required, bool? mutualExclusiveness) { var commandLineOptionsBase = options as CommandLineOptionsBase; if (commandLineOptionsBase == null) return; var error = new ParsingError { BadOption = { ShortName = option.ShortName, LongName = option.LongName } }; if (required != null) error.ViolatesRequired = required.Value; if (mutualExclusiveness != null) error.ViolatesMutualExclusiveness = mutualExclusiveness.Value; (commandLineOptionsBase).InternalLastPostParsingState.AddError(error); }
public MutuallyExclusiveInfo(OptionInfo option) { BadOption = option; }
private void BuildMutuallyExclusiveMap(OptionInfo option) { var setName = option.MutuallyExclusiveSet; if (!_mutuallyExclusiveSetMap.ContainsKey(setName)) { _mutuallyExclusiveSetMap.Add(setName, new MutuallyExclusiveInfo(option)); } _mutuallyExclusiveSetMap[setName].IncrementOccurrence(); }
protected static void EnsureOptionAttributeIsArrayCompatible(OptionInfo option) { if (!option.IsAttributeArrayCompatible) throw new CommandLineParserException(); }
protected static void EnsureOptionArrayAttributeIsNotBoundToScalar(OptionInfo option) { if (!option.IsArray && option.IsAttributeArrayCompatible) throw new CommandLineParserException(); }
protected void DefineOptionThatViolatesFormat(OptionInfo option) { PostParsingState.Add(new ParsingError(option.ShortName, option.LongName, true)); }