Contains extensions for IConfigurator and IConfigurator.
Methods
public static ICommandConfigurator AddAsyncDelegate(IConfigurator configurator, string name, Func<CommandContext, CancellationToken, Task<int>> func)
Adds a command without settings that executes an async delegate.
Parameters:
configurator (IConfigurator)name (string)func (Func<CommandContext, CancellationToken, Task<int>>)Returns:
A command configurator that can be used to configure the command further.
public static ICommandConfigurator AddAsyncDelegate<TSettings>(IConfigurator<TSettings> configurator, string name, Func<CommandContext, CancellationToken, Task<int>> func)
Adds a command without settings that executes an async delegate.
Parameters:
configurator (IConfigurator<TSettings>)name (string)func (Func<CommandContext, CancellationToken, Task<int>>)Returns:
A command configurator that can be used to configure the command further.
public static IBranchConfigurator AddBranch(IConfigurator configurator, string name, Action<IConfigurator<CommandSettings>> action)
Adds a command branch.
Parameters:
configurator (IConfigurator)name (string)action (Action<IConfigurator<CommandSettings>>)Returns:
A branch configurator that can be used to configure the branch further.
public static IBranchConfigurator AddBranch<TSettings>(IConfigurator<TSettings> configurator, string name, Action<IConfigurator<TSettings>> action)
Adds a command branch.
Parameters:
configurator (IConfigurator<TSettings>)name (string)action (Action<IConfigurator<TSettings>>)Returns:
A branch configurator that can be used to configure the branch further.
public static ICommandConfigurator AddDelegate(IConfigurator configurator, string name, Func<CommandContext, CancellationToken, int> func)
Adds a command without settings that executes a delegate.
Parameters:
configurator (IConfigurator)name (string)func (Func<CommandContext, CancellationToken, int>)Returns:
A command configurator that can be used to configure the command further.
public static ICommandConfigurator AddDelegate<TSettings>(IConfigurator<TSettings> configurator, string name, Func<CommandContext, CancellationToken, int> func)
Adds a command without settings that executes a delegate.
Parameters:
configurator (IConfigurator<TSettings>)name (string)func (Func<CommandContext, CancellationToken, int>)Returns:
A command configurator that can be used to configure the command further.
public static IConfigurator CancellationExitCode(IConfigurator configurator, int exitCode)
Tells the command line application to return the specified exit code when it's aborted through the CancellationToken. The default cancellation exit code is 130.
Parameters:
configurator (IConfigurator)exitCode (int)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator CaseSensitivity(IConfigurator configurator, CaseSensitivity sensitivity)
Configures case sensitivity.
Parameters:
configurator (IConfigurator)sensitivity (CaseSensitivity)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator HideOptionDefaultValues(IConfigurator configurator)
Hides the DEFAULT column that lists default values coming from the DefaultValueAttribute in the options help text.
Parameters:
configurator (IConfigurator)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator PropagateExceptions(IConfigurator configurator)
Tells the command line application to propagate all exceptions to the user.
Parameters:
configurator (IConfigurator)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetApplicationCulture(IConfigurator configurator, CultureInfo culture)
Sets the culture for the application.
Parameters:
configurator (IConfigurator)culture (CultureInfo)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetApplicationName(IConfigurator configurator, string name)
Sets the name of the application.
Parameters:
configurator (IConfigurator)name (string)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetApplicationVersion(IConfigurator configurator, string version)
Sets the version of the application.
Parameters:
configurator (IConfigurator)version (string)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetExceptionHandler(IConfigurator configurator, Action<Exception, ITypeResolver> exceptionHandler)
Sets the ExceptionsHandler. Setting ExceptionHandler this way will use the default exit code of -1.
Parameters:
configurator (IConfigurator)exceptionHandler (Action<Exception, ITypeResolver>)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetExceptionHandler(IConfigurator configurator, Func<Exception, ITypeResolver, int> exceptionHandler)
Sets the ExceptionsHandler.
Parameters:
configurator (IConfigurator)exceptionHandler (Func<Exception, ITypeResolver, int>)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetHelpProvider(IConfigurator configurator, IHelpProvider helpProvider)
Sets the help provider for the application.
Parameters:
configurator (IConfigurator)helpProvider (IHelpProvider)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetHelpProvider<T>(IConfigurator configurator)
Sets the help provider for the application.
Parameters:
configurator (IConfigurator)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator SetInterceptor(IConfigurator configurator, ICommandInterceptor interceptor)
Sets the command interceptor to be used.
Parameters:
configurator (IConfigurator)interceptor (ICommandInterceptor)ICommandInterceptor.Returns:
A configurator that can be used to configure the application further.
public static IConfigurator TrimTrailingPeriods(IConfigurator configurator, bool trimTrailingPeriods)
Tells the help provider whether or not to trim trailing period.
Parameters:
configurator (IConfigurator)trimTrailingPeriods (bool)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator UseAssemblyInformationalVersion(IConfigurator configurator)
Uses the version retrieved from the AssemblyInformationalVersionAttribute as the application's version.
Parameters:
configurator (IConfigurator)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator UseStrictParsing(IConfigurator configurator)
Sets the parsing mode to strict.
Parameters:
configurator (IConfigurator)Returns:
A configurator that can be used to configure the application further.
public static IConfigurator ValidateExamples(IConfigurator configurator)
Tells the command line application to validate all examples before running the application.
Parameters:
configurator (IConfigurator)Returns:
A configurator that can be used to configure the application further.