Edit

Share via


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.

Methods

Build()

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

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.

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.

UseTokenReplacer(CommandLineBuilder, TryReplaceToken)

Specifies a delegate used to replace any token prefixed with @ with zero or more other tokens, prior to parsing.

UseTypoCorrections(CommandLineBuilder, Int32)

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

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.

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.

ConfigureHelpFromXmlComments(CommandLineBuilder, MethodInfo, String)
ConfigureRootCommandFromMethod(CommandLineBuilder, MethodInfo, Object)
UseHost(CommandLineBuilder, Action<IHostBuilder>)
UseHost(CommandLineBuilder, Func<String[],IHostBuilder>, Action<IHostBuilder>)
UseAnsiTerminalWhenAvailable(CommandLineBuilder)

Applies to