Table of Contents

CliParser.RunAsync Method

Definition

Namespace
DotMake.CommandLine
Assembly
DotMake.CommandLine.dll

RunAsync(string[], CancellationToken)

Parses a command line string array and runs the handler asynchronously for the indicated command.

public Task<int> RunAsync(string[] args = null, CancellationToken cancellationToken = default)

Parameters

args string[]

The string array typically passed to a program. This is usually the special variable args available in Program.cs (new style with top-level statements) or the string array passed to the program's Main method (old style). If not specified or null, args will be retrieved automatically from the current process via DotMake.CommandLine.CliParser.GetArgs().

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<int>

The exit code for the invocation.

RunAsync(string, CancellationToken)

Parses a command line string value and runs the handler asynchronously for the indicated command.

public Task<int> RunAsync(string commandLine, CancellationToken cancellationToken = default)

Parameters

commandLine string

The command line string that will be split into tokens as if it had been passed on the command line. Useful for testing command line input by just specifying it as a single string.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<int>

The exit code for the invocation.