using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Parsing; using System.Linq; namespace MfGames.ToolBuilder.Extensions { public static class ParseResultExtensions { public static List ValueListForOption( this ParseResult result, Option option) { string? optionValues = result.ValueForOption(option); if (optionValues == null) { return new List(); } var values = optionValues .Split(',') .Select(x => x.Trim()) .SelectMany(x => x.Split(' ')) .Select(x => x.Trim()) .Where(x => !string.IsNullOrWhiteSpace(x)) .ToList(); return values; } } }