private OptionData AddOption(IOptionInfo info, OptionSet set) { OptionData s = new OptionData(); set.Add(info.GetPrototype(), info.Description, v => s.Data.Add(v)); return(s); }
private OptionData AddOption(PositionalOptionInfo info, OptionSet set) { OptionData s = new OptionData(); set.Add(info.GetPrototype(), info.Description, info.MaxNumValues, v => s.Data.Add(v.ToList())); return(s); }
private static IParsingResult GetParseResult(OptionInfo <string> optionInfo, OptionData optionData) { ParsingResult <string> result = ParsingResult <string> .SuccessfulResult(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))); }
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); }
private static IParsingResult GetParseResult(OptionInfo <List <string> > multiOptionInfo, OptionData optionData) { return(multiOptionInfo.Parse(new SuccessfulResultCollection(multiOptionInfo, ParsingResult <List <string> > .SuccessfulResult(optionData.Data)))); }
private static IParsingResult GetParseResult(OptionInfo <List <string> > multiOptionInfo, OptionData optionData) { return(multiOptionInfo.Parse(new SuccessfulResultCollection(multiOptionInfo, ParsingResult <List <string> > .SuccessfulResult(optionData.Data.Select(list => list.FirstOrDefault()).ToList())))); }