private static Dictionary ParseArgs()

in openapi-diff/src/core/OpenApiDiff.Core/Settings.cs [91:123]


        private static Dictionary<string, object> ParseArgs(string[] arguments)
        {
            var argsDictionary = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
            if (arguments != null && arguments.Length > 0)
            {
                string key = null;
                string value = null;
                for (int i = 0; i < arguments.Length; i++)
                {
                    string argument = arguments[i] ?? String.Empty;
                    argument = argument.Trim();

                    if (argument.StartsWith("-", StringComparison.OrdinalIgnoreCase))
                    {
                        if (key != null)
                        {
                            AddArgumentToDictionary(key, value, argsDictionary);
                            value = null;
                        }
                        key = argument.TrimStart('-');
                    }
                    else
                    {
                        value = argument;
                    }
                }
                if (key != null)
                {
                    AddArgumentToDictionary(key, value, argsDictionary);
                }
            }
            return argsDictionary;
        }