Table of Contents

Class BaseHandler<T>

Namespace
Albatross.CommandLine
Assembly
Albatross.CommandLine.dll

Abstract base class for command handlers that provides common functionality for processing parsed command parameters. Inherit from this class to implement custom command handlers with strongly-typed parameter access.

public abstract class BaseHandler<T> : IAsyncCommandHandler where T : class

Type Parameters

T

The type of the command parameters class.

Inheritance
BaseHandler<T>
Implements
Inherited Members

Constructors

BaseHandler(ParseResult, T)

Initializes a new instance of the handler with the parse result and parameters.

protected BaseHandler(ParseResult result, T parameters)

Parameters

result ParseResult
parameters T

Fields

parameters

The strongly-typed command parameters.

protected readonly T parameters

Field Value

T

result

The parse result from command line parsing.

protected ParseResult result

Field Value

ParseResult

Properties

Writer

Gets the text writer for command output. Defaults to the invocation configuration output.

protected virtual TextWriter Writer { get; }

Property Value

TextWriter

Methods

InvokeAsync(CancellationToken)

public abstract Task<int> InvokeAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<int>