Пример #1
0
        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);
        }
Пример #2
0
 public MutuallyExclusiveInfo(OptionInfo option)
 {
     BadOption = option;
 }
Пример #3
0
        private void BuildMutuallyExclusiveMap(OptionInfo option)
        {
            var setName = option.MutuallyExclusiveSet;

            if (!_mutuallyExclusiveSetMap.ContainsKey(setName))
            {
                _mutuallyExclusiveSetMap.Add(setName, new MutuallyExclusiveInfo(option));
            }

            _mutuallyExclusiveSetMap[setName].IncrementOccurrence();
        }
Пример #4
0
 protected static void EnsureOptionAttributeIsArrayCompatible(OptionInfo option)
 {
     if (!option.IsAttributeArrayCompatible)
         throw new CommandLineParserException();
 }
Пример #5
0
 protected static void EnsureOptionArrayAttributeIsNotBoundToScalar(OptionInfo option)
 {
     if (!option.IsArray && option.IsAttributeArrayCompatible)
         throw new CommandLineParserException();
 }
Пример #6
0
 protected void DefineOptionThatViolatesFormat(OptionInfo option)
 {
     PostParsingState.Add(new ParsingError(option.ShortName, option.LongName, true));
 }