示例#1
0
 public static Task <int> InvokeAsync(
     this Command command,
     string commandLine,
     IConsole?console = null
     ) =>
 command.InvokeAsync(
     CommandLineStringSplitter.Instance.Split(commandLine).ToArray(),
     console
     );
示例#2
0
 /// <summary>
 /// Parses and invokes a command.
 /// </summary>
 /// <remarks>The command line string input will be split into tokens as if it had been passed on the command line.</remarks>
 /// <param name="command">The command to invoke.</param>
 /// <param name="commandLine">The command line to parse.</param>
 /// <param name="console">The console to which output is written during invocation.</param>
 /// <param name="cancellationToken">A token that can be used to cancel the invocation.</param>
 /// <returns>The exit code for the invocation.</returns>
 public static Task <int> InvokeAsync(
     this Command command,
     string commandLine,
     IConsole?console = null,
     CancellationToken cancellationToken = default) =>
 command.InvokeAsync(CommandLineStringSplitter.Instance.Split(commandLine).ToArray(), console, cancellationToken);