Skip to content

Interface IConsoleService

Namespace: Void.Proxy.Api.Console
Assembly: Void.Proxy.Api.dll

public interface IConsoleService : ICommandSource

Implements

ICommandSource

Methods

EnsureOptionDiscovered(Option)

Ensures that the specified command-line option is discovered by platform.

void EnsureOptionDiscovered(Option option)

Parameters

option Option

The option to be marked as discovered. Cannot be null.

Remarks

This method is typically used to track options that have been identified during processing.

GetOptionValue<TValue>(Option<TValue>)

Retrieves the value associated with the specified option from the parsed command-line arguments.

TValue? GetOptionValue<TValue>(Option<TValue> option)

Parameters

option Option<TValue>

The option whose value is to be retrieved. Cannot be null.

Returns

TValue?

The value of the specified option if it is present; otherwise, null.

Type Parameters

TValue

The type of the value associated with the option.

Remarks

Use this method to access the value of a specific option after parsing command-line arguments. If the option is not present in the arguments, the method returns null.

GetRequiredOptionValue<TValue>(Option<TValue>)

Retrieves the value of the specified option, ensuring that it is set from the parsed command-line arguments.

TValue GetRequiredOptionValue<TValue>(Option<TValue> option)

Parameters

option Option<TValue>

The option whose value is to be retrieved. Cannot be null.

Returns

TValue

The value of the specified option.

Type Parameters

TValue

The type of the value associated with the option.

HandleCommandsAsync(CancellationToken)

Asynchronously processes a single incoming command in the terminal until cancellation is requested. Do not call this method directly.

ValueTask HandleCommandsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to monitor for cancellation requests. The operation will stop processing current command if the token is canceled.

Returns

ValueTask

A representing the asynchronous operation.

TryGetOptionValue<TValue>(Option<TValue>, out TValue)

Attempts to retrieve the value associated with the specified option from the parsed command-line arguments.

bool TryGetOptionValue<TValue>(Option<TValue> option, out TValue value)

Parameters

option Option<TValue>

The option for which to retrieve the value. Cannot be null.

value TValue

When this method returns true, contains the value associated with the specified option. When this method returns false, the value is null.

Returns

bool

true if the value for the specified option was successfully retrieved; otherwise, false.

Type Parameters

TValue

The type of the value associated with the option.