Table of Contents

Class EndpointCommand<TEndpoint>

Namespace
TypedRest.CommandLine.Commands
Assembly
TypedRest.CommandLine.dll

Command operating on an IEndpoint.

public abstract class EndpointCommand<TEndpoint> : IEndpointCommand where TEndpoint : IEndpoint

Type Parameters

TEndpoint

The specific type of IEndpoint to operate on.

Inheritance
EndpointCommand<TEndpoint>
Implements
Derived
Inherited Members

Constructors

EndpointCommand(TEndpoint)

Command operating on an IEndpoint.

protected EndpointCommand(TEndpoint endpoint)

Parameters

endpoint TEndpoint

The endpoint this command operates on.

Fields

Endpoint

The endpoint this command operates on.

protected readonly TEndpoint Endpoint

Field Value

TEndpoint

Properties

Console

The text input/output device used for user interaction.

public IConsole Console { get; set; }

Property Value

IConsole

Methods

ExecuteAsync(IReadOnlyList<string>, CancellationToken)

Parses command-line arguments and executes the resulting operation.

public virtual Task ExecuteAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)

Parameters

args IReadOnlyList<string>

the console arguments.

cancellationToken CancellationToken

Used to cancel the request.

Returns

Task

ExecuteInnerAsync(IReadOnlyList<string>, CancellationToken)

Parses command-line arguments and executes the resulting operation when no additional sub-IEndpointCommand is specified.

protected virtual Task ExecuteInnerAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)

Parameters

args IReadOnlyList<string>

the console arguments.

cancellationToken CancellationToken

Used to cancel the request.

Returns

Task

GetSubCommand(string)

Creates a sub-IEndpointCommand based on the given name.

protected virtual IEndpointCommand? GetSubCommand(string name)

Parameters

name string

Returns

IEndpointCommand

The IEndpointCommand or null if the name does not match.

Input<T>(IReadOnlyList<string>)

Reads an input object (usually in JSON format) either from the command-line or stdin.

protected virtual T Input<T>(IReadOnlyList<string> args)

Parameters

args IReadOnlyList<string>

The command-line to check for input data.

Returns

T

Type Parameters

T

The type of object to read.