C# Class System.CommandLine.CommandLineConfiguration

Show file Open project: dotnet/command-line-api Class Usage Examples

Private Properties

Property Type Description
DefaultHelpBuilderFactory System.CommandLine.HelpBuilder
DefaultHelpBuilderFactory System.Collections.Generic
DefaultTokenReplacer bool
GetChild System.CommandLine.IdentifierSymbol
ThrowIfInvalid void

Public Methods

Method Description
CommandLineConfiguration ( System.CommandLine.Command command, bool enablePosixBundling = true, bool enableDirectives = true, bool enableTokenReplacement = true, LocalizationResources? resources = null, IReadOnlyList? middlewarePipeline = null, HelpBuilder>?.Func helpBuilderFactory = null, TryReplaceToken? tokenReplacer = null ) : System.Collections.Generic

Initializes a new instance of the CommandLineConfiguration class.

ThrowIfInvalid ( ) : void

Throws an exception if the parser configuration is ambiguous or otherwise not valid.

Due to the performance cost of this method, it is recommended to be used in unit testing or in scenarios where the parser is configured dynamically at runtime.

Private Methods

Method Description
DefaultHelpBuilderFactory ( BindingContext context, int? requestedMaxWidth = null ) : System.CommandLine.HelpBuilder
DefaultHelpBuilderFactory ( ) : System.Collections.Generic
DefaultTokenReplacer ( string tokenToReplace, IReadOnlyList? &replacementTokens, string? &errorMessage ) : bool
GetChild ( int index, System.CommandLine.Command command ) : System.CommandLine.IdentifierSymbol
ThrowIfInvalid ( System.CommandLine.Command command ) : void

Method Details

CommandLineConfiguration() public method

Initializes a new instance of the CommandLineConfiguration class.
public CommandLineConfiguration ( System.CommandLine.Command command, bool enablePosixBundling = true, bool enableDirectives = true, bool enableTokenReplacement = true, LocalizationResources? resources = null, IReadOnlyList? middlewarePipeline = null, HelpBuilder>?.Func helpBuilderFactory = null, TryReplaceToken? tokenReplacer = null ) : System.Collections.Generic
command System.CommandLine.Command The root command for the parser.
enablePosixBundling bool to enable POSIX bundling; otherwise, .
enableDirectives bool to enable directive parsing; otherwise, .
enableTokenReplacement bool to enable token replacement; otherwise, .
resources LocalizationResources? Provide custom validation messages.
middlewarePipeline IReadOnlyList? Provide a custom middleware pipeline.
helpBuilderFactory HelpBuilder>?.Func Provide a custom help builder.
tokenReplacer TryReplaceToken? Replaces the specified token with any number of other tokens.
return System.Collections.Generic

ThrowIfInvalid() public method

Throws an exception if the parser configuration is ambiguous or otherwise not valid.
Due to the performance cost of this method, it is recommended to be used in unit testing or in scenarios where the parser is configured dynamically at runtime.
Thrown if the configuration is found to be invalid.
public ThrowIfInvalid ( ) : void
return void