CommandLineBuilder Class

Definition

Enables composition of command line configurations.

public ref class CommandLineBuilder
public class CommandLineBuilder
type CommandLineBuilder = class
Public Class CommandLineBuilder
Inheritance
CommandLineBuilder

Constructors

CommandLineBuilder(Command)

Properties

Command

The command that the builder uses the root of the parser.

EnableDirectives

Determines whether the parser recognizes command line directives.

EnableLegacyDoubleDashBehavior

Determines the behavior when parsing a double dash (--) in a command line.

EnablePosixBundling

Determines whether the parser recognize and expands POSIX-style bundled options.

ResponseFileHandling

Configures the parser's handling of response files. When enabled, a command line token beginning with @ that is a valid file path will be expanded as though inserted into the command line.

Methods

Build()

Creates a parser based on the configuration of the command line builder.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

AddMiddleware(CommandLineBuilder, Action<InvocationContext>, MiddlewareOrder)

Adds a middleware delegate to the invocation pipeline called before a command handler is invoked.

AddMiddleware(CommandLineBuilder, InvocationMiddleware, MiddlewareOrder)

Adds a middleware delegate to the invocation pipeline called before a command handler is invoked.

CancelOnProcessTermination(CommandLineBuilder)

Enables signaling and handling of process termination via a CancellationToken that can be passed to a ICommandHandler during invocation.

EnableDirectives(CommandLineBuilder, Boolean)

Enables the parser to recognize command line directives.

EnableLegacyDoubleDashBehavior(CommandLineBuilder, Boolean)

Determines the behavior when parsing a double dash (--) in a command line.

EnablePosixBundling(CommandLineBuilder, Boolean)

Enables the parser to recognize and expand POSIX-style bundled options.

ParseResponseFileAs(CommandLineBuilder, ResponseFileHandling)

Configures the parser's handling of response files. When enabled, a command line token beginning with @ that is a valid file path will be expanded as though inserted into the command line.

RegisterWithDotnetSuggest(CommandLineBuilder)

Ensures that the application is registered with the dotnet-suggest tool to enable command line completions.

UseDefaults(CommandLineBuilder)

Uses the default configuration.

UseEnvironmentVariableDirective(CommandLineBuilder)

Enables the use of the [env:key=value] directive, allowing environment variables to be set from the command line during invocation.

UseExceptionHandler(CommandLineBuilder, Action<Exception,InvocationContext>, Nullable<Int32>)

Enables an exception handler to catch any unhandled exceptions thrown by a command handler during invocation.

UseHelp(CommandLineBuilder, Action<HelpContext>, Nullable<Int32>)

Configures the application to show help when one of the specified option aliases are used on the command line.

UseHelp(CommandLineBuilder, Nullable<Int32>)

Configures the application to show help when one of the following options are specified on the command line:

-h
/h
--help
-?
/?
UseHelp(CommandLineBuilder, String[])

Configures the application to show help when one of the specified option aliases are used on the command line.

UseLocalizationResources(CommandLineBuilder, LocalizationResources)

Specifies localization resources to be used when displaying help, error messages, and other user-facing strings.

UseParseDirective(CommandLineBuilder, Nullable<Int32>)

Enables the use of the [parse] directive, which when specified on the command line will short circuit normal command handling and display a diagram explaining the parse result for the command line input.

UseParseErrorReporting(CommandLineBuilder, Nullable<Int32>)

Configures the command line to write error information to standard error when there are errors parsing command line input.

UseSuggestDirective(CommandLineBuilder)

Enables the use of the [suggest] directive which when specified in command line input short circuits normal command handling and writes a newline-delimited list of suggestions suitable for use by most shells to provide command line completions.

UseTypoCorrections(CommandLineBuilder, Int32)

Configures the application to provide alternative suggestions when a parse error is detected.

UseVersionOption(CommandLineBuilder)

Enables the use of a option (defaulting to the alias --version) which when specified in command line input will short circuit normal command handling and instead write out version information before exiting.

UseVersionOption(CommandLineBuilder, String[])

Enables the use of a option (defaulting to the alias --version) which when specified in command line input will short circuit normal command handling and instead write out version information before exiting.

Applies to