public void Parse(string[] args, IEnumerable<IOption> optionsEnumerable, IEnumerable<IPositionalArgument> positionalArgumentsEnumerable, IParserResult result)
        {
            var allowOptions = true;
            var options = optionsEnumerable.ToList();
            var positionals = positionalArgumentsEnumerable.ToList();
            var argQueue = new Queue<string>();
            foreach (var arg in args)
            {
                argQueue.Enqueue(arg);
            }

            while (argQueue.Count > 0)
            {
                var arg = argQueue.Dequeue();
                ParseOutcome outcome;
                if (allowOptions && arg.StartsWith("-"))
                {
                    if (arg == "--")
                    {
                        allowOptions = false;
                        continue;
                    }
                    outcome = GetOption(result, argQueue, arg.Substring(1), options, positionals);
                }
                else
                    outcome = result.PositionalArgument(arg);

                if (outcome == ParseOutcome.Halt) return;
            }
        }
        public void Parse(string[] args, IEnumerable<IOption> options, IEnumerable<IPositionalArgument> positionalArguments, IParserResult result)
        {
            var optionList = options as IOption[] ?? options.ToArray();
            var argQueue = new Queue<string>();
            foreach (var arg in args)
            {
                argQueue.Enqueue(arg);
            }

            while (argQueue.Count > 0)
            {
                var arg = argQueue.Dequeue();

                ParseOutcome outcome;
                if (arg.StartsWith("/"))
                    outcome = ProcessOption(optionList, arg, argQueue, result);
                else
                    outcome = result.PositionalArgument(arg);

                if (outcome == ParseOutcome.Halt)
                    return;
            }
        }
        public void Parse(string[] args, IEnumerable<IOption> options, IEnumerable<IPositionalArgument> positionalArguments, IParserResult result)
        {
            var allowOptions = true;
            var optionList = options.ToList();

            var shortOptions = optionList.Where(o => o.Name.Length == 1).ToList(); //these need "-"
            var longOptions = optionList.Where(o => o.Name.Length > 1).ToList();  // these need "--"

            var argQueue = new Queue<string>();

            foreach (var arg in args)
                argQueue.Enqueue(arg);
            while (argQueue.Count > 0)
            {
                ParseOutcome outcome;
                var arg = argQueue.Dequeue();
                if (allowOptions && arg.StartsWith("--"))
                {
                    var optionName = arg.Substring(2);
                    if (optionName == string.Empty)
                    {
                        allowOptions = false;
                        continue;
                    }

                    outcome = ProcessLongOption(longOptions, optionName, argQueue, result);
                }
                else if (allowOptions && arg.StartsWith("-"))
                    outcome = ProcessShortOption(shortOptions, arg.Substring(1), argQueue, result);
                else
                    outcome = result.PositionalArgument(arg);

                if (outcome == ParseOutcome.Halt)
                    return;
            }
        }