Esempio n. 1
0
        private OptionData AddOption(IOptionInfo info, OptionSet set)
        {
            OptionData s = new OptionData();

            set.Add(info.GetPrototype(), info.Description, v => s.Data.Add(v));
            return(s);
        }
Esempio n. 2
0
        private static IParsingResult GetParseResult(OptionInfo <string> optionInfo, OptionData optionData)
        {
            ParsingResult <string> result = ParsingResult <string> .SuccesfulResult(optionData.Data.FirstOrDefault());

            if (optionData.Data.Count > 1)
            {
                result = ParsingResult <string> .FailedResult($"Error: {optionInfo.Name} can only be specified once");
            }
            return(optionInfo.Parse(new SuccessfulResultCollection(optionInfo, result)));
        }
Esempio n. 3
0
        private OptionSet GetOptionSet(out Dictionary <IOption, OptionData> optionResults)
        {
            optionResults = new Dictionary <IOption, OptionData>();
            OptionSet options = new OptionSet();

            foreach (var option in GetLeafs())
            {
                OptionData result = AddOption(option, options);
                optionResults.Add(option, result);
            }
            return(options);
        }
Esempio n. 4
0
 private static IParsingResult GetParseResult(OptionInfo <List <string> > multiOptionInfo, OptionData optionData)
 {
     return(multiOptionInfo.Parse(new SuccessfulResultCollection(multiOptionInfo, ParsingResult <List <string> > .SuccesfulResult(optionData.Data))));
 }