Table of Contents

Class AppCommand<TSettings>

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

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

public abstract class AppCommand<TSettings> : Command<TSettings>, ICommand<TSettings>, ICommandLimiter<TSettings>, ICommand where TSettings : CommandSettings

Type Parameters

TSettings

The type of settings used by the command.

Inheritance
Command<TSettings>
AppCommand<TSettings>
Implements
ICommand<TSettings>
ICommandLimiter<TSettings>
ICommand
Inherited Members

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.

Constructors

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

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

Properties

Output

Gets the output writer used to render command output.

Methods

DoExecute(CommandContext, TSettings, CancellationToken)

Implements the command's core execution logic.

Execute(CommandContext, TSettings, CancellationToken)

Executes the command with the specified context and settings.

Validate(CommandContext, TSettings)

Validates the command settings using the provided validator.