Пример #1
0
        public override IPreParsingState MoveToNext(string argument)
        {
            if (IsEndOfArguments(argument))
            {
                throw new ArgParsingException(ArgsParsingErrorCode.CannotFindValueForOption, labelArgument);
            }

            resultBuilder.AppendOptionToken(new OptionToken(kvOption, argument), $"{labelArgument} {argument}");
            return(new ContinueState(command, resultBuilder));
        }
Пример #2
0
        protected static IPreParsingState HandleFlagOptionArgument(
            ICommandDefinition command,
            PreParserResultBuilder resultBuilder,
            string argument)
        {
            IList <IOptionDefinition> flagOptions = ResolveFlagOptionLabels(
                command,
                argument);

            if (flagOptions.Count > 0)
            {
                foreach (IOptionDefinition flagOption in flagOptions)
                {
                    resultBuilder.AppendOptionToken(new OptionToken(flagOption), argument);
                }
                return(new ContinueState(command, resultBuilder));
            }

            return(null);
        }