private async Task ParseCommandAsync(CommandLineCommandBase cmd, ParseResult <TOption> result, CancellationToken cancellationToken)
        {
            var found = ArgumentManager.TryGetValue(cmd, out var model);

            if (!found)
            {
                result.MergeResult(new CommandNotFoundParserResult(cmd));

                if (cmd.IsRequired)
                {
                    throw new CommandNotFoundException(cmd);
                }

                return;
            }
            else if (found && HelpRequested(result, cmd, model))
            {
                return;
            }

            var cmdParseResult = await cmd.ParseAsync(cancellationToken);

            result.MergeResult(cmdParseResult);

            if (cmdParseResult.HasErrors)
            {
                throw new CommandParseException(cmd, cmdParseResult.Errors);
            }
        }
Example #2
0
 public CommandParserResult(CommandLineCommandBase command)
 {
     m_cmd = command;
 }