private static()

in plugin-dotnet-agent/src/main/csharp/TeamCity.Dotnet.TestSuppressor/TeamCity.Dotnet.TestSuppressor/Infrastructure/CommandLine/Parsing/CommandLineParser.cs [121:158]


    private static (bool, string) TryParseOption(
        IEnumerable<PropertyInfo> properties, string argument, IEnumerable<string> commandPath, IDictionary<string, string> mappingsResult)
    {
        var isOption = false;
        var key = string.Empty;
        foreach (var (optionProperty, optionAttribute) in OnlyWithAttribute<CommandOptionAttribute>(properties))
        {
            // if current argument is an option...
            if (optionAttribute.Options.All(o => o != argument.ToLowerInvariant()))
            {
                continue;
            }

            isOption = true;

            // ...and requires value – next argument is value
            if (optionAttribute.RequiresValue)
            {
                key = Key(commandPath, optionProperty.Name);
                
                // if option is array – add index to key
                if (optionProperty.PropertyType.IsArray)
                {
                    var index = mappingsResult.Count(kv => kv.Key.StartsWith($"{key}:"));
                    key += $":{index}";
                }
            }
            else
            {
                // ...and doesn't require value – it's a flag option – set true
                mappingsResult.Add(Key(commandPath, optionProperty.Name), True);
            }

            break;
        }

        return (isOption, key);
    }