IConfigurator<>

Represents a configurator for specific settings.

Represents a configurator for specific settings.

Methods

public ICommandConfigurator AddAsyncDelegate<TDerivedSettings>(string name, Func<CommandContext, TDerivedSettings, CancellationToken, Task<int>> func)

Adds a command that executes an async delegate.

Parameters:

name (string)
The name of the command.
func (Func<CommandContext, TDerivedSettings, CancellationToken, Task<int>>)
The delegate to execute as part of command execution.

Returns:

A command configurator that can be used to configure the command further.

public IBranchConfigurator AddBranch<TDerivedSettings>(string name, Action<IConfigurator<TDerivedSettings>> action)

Adds a command branch.

Parameters:

name (string)
The name of the command branch.
action (Action<IConfigurator<TDerivedSettings>>)
The command branch configuration.

Returns:

A branch configurator that can be used to configure the branch further.

public ICommandConfigurator AddCommand<TCommand>(string name)

Adds a command.

Parameters:

name (string)
The name of the command.

Returns:

A command configurator that can be used to configure the command further.

public ICommandConfigurator AddDelegate<TDerivedSettings>(string name, Func<CommandContext, TDerivedSettings, CancellationToken, int> func)

Adds a command that executes a delegate.

Parameters:

name (string)
The name of the command.
func (Func<CommandContext, TDerivedSettings, CancellationToken, int>)
The delegate to execute as part of command execution.

Returns:

A command configurator that can be used to configure the command further.

public void AddExample(string[] args)

Adds an example of how to use the branch.

Parameters:

args (string[])
The example arguments.
public void HideBranch()

Marks the branch as hidden. Hidden branches do not show up in help documentation or generated XML models.

public void SetDefaultCommand<TDefaultCommand>()

Adds a default command.

public void SetDescription(string description)

Sets the description of the branch.

Parameters:

description (string)
The description of the branch.

Extension Methods

IConfigurator HideOptionDefaultValues(this IConfigurator configurator)

Hides the DEFAULT column that lists default values coming from the DefaultValueAttribute in the options help text.

Returns:

A configurator that can be used to configure the application further.

IUnsafeConfigurator SafetyOff(this IConfigurator configurator)

Gets an IUnsafeConfigurator that allows composition of commands without type safety.

Returns:

An IUnsafeConfigurator.

IUnsafeConfigurator SafetyOff<TSettings>(this IConfigurator<TSettings> configurator)

Gets an IUnsafeConfigurator that allows composition of commands without type safety.

Returns:

An IUnsafeConfigurator.

IConfigurator SetApplicationCulture(this IConfigurator configurator, CultureInfo culture)

Sets the culture for the application.

Returns:

A configurator that can be used to configure the application further.

IConfigurator SetApplicationName(this IConfigurator configurator, string name)

Sets the name of the application.

Returns:

A configurator that can be used to configure the application further.

IConfigurator SetApplicationVersion(this IConfigurator configurator, string version)

Sets the version of the application.

Returns:

A configurator that can be used to configure the application further.

IConfigurator SetHelpProvider(this IConfigurator configurator, IHelpProvider helpProvider)

Sets the help provider for the application.

Returns:

A configurator that can be used to configure the application further.

IConfigurator SetHelpProvider<T>(this IConfigurator configurator)

Sets the help provider for the application.

Returns:

A configurator that can be used to configure the application further.

IConfigurator UseAssemblyInformationalVersion(this IConfigurator configurator)

Uses the version retrieved from the AssemblyInformationalVersionAttribute as the application's version.

Returns:

A configurator that can be used to configure the application further.