Table of Contents

Constructor AppCommand

Namespace
Ploch.CommandLine.Spectre.Commands
Assembly
Ploch.CommandLine.Spectre.dll

AppCommand(CommandArgumentsRootProcessor, ICommandSettingsValidator<TSettings>, IExceptionHandler, IOutput)

Base class for application commands that provides common functionality for command execution and validation.

protected AppCommand(CommandArgumentsRootProcessor settingsProcessor, ICommandSettingsValidator<TSettings> validator, IExceptionHandler exceptionHandler, IOutput output)

Parameters

settingsProcessor CommandArgumentsRootProcessor

The processor applied to the command settings before execution.

validator ICommandSettingsValidator<TSettings>

The validator used to validate command settings.

exceptionHandler IExceptionHandler

The handler used to process exceptions that occur during command execution.

output IOutput

The output writer used to render command output.

Remarks

This is the synchronous counterpart of AsyncAppCommand<TSettings> and performs the same framework work around DoExecute(CommandContext, TSettings, CancellationToken): it runs the settings processor and routes exceptions to the IExceptionHandler. It writes nothing to output itself; the "Executing command" line that announces the command is written to standard error by the application before the command runs.