Table of Contents

Interface IReplInteractionChannel

Namespace
Repl.Interaction
Assembly
Repl.Core.dll

Provides bidirectional interaction during command execution.

public interface IReplInteractionChannel
Extension Methods

Methods

AskChoiceAsync(string, string, IReadOnlyList<string>, int?, AskOptions?)

Prompts the user for one option from a choice list.

ValueTask<int> AskChoiceAsync(string name, string prompt, IReadOnlyList<string> choices, int? defaultIndex = null, AskOptions? options = null)

Parameters

name string

Prompt name.

prompt string

Prompt text.

choices IReadOnlyList<string>

Selectable choices.

defaultIndex int?

Index of the default choice returned on empty input, or null to use the first choice.

options AskOptions

Optional ask options (cancellation, timeout). When null or token is default, uses the ambient per-command token.

Returns

ValueTask<int>

The zero-based index of the selected choice.

AskConfirmationAsync(string, string, bool?, AskOptions?)

Prompts the user for confirmation.

ValueTask<bool> AskConfirmationAsync(string name, string prompt, bool? defaultValue = null, AskOptions? options = null)

Parameters

name string

Prompt name.

prompt string

Prompt text.

defaultValue bool?

Default choice.

options AskOptions

Optional ask options (cancellation, timeout). When null or token is default, uses the ambient per-command token.

Returns

ValueTask<bool>

True when confirmed.

AskMultiChoiceAsync(string, string, IReadOnlyList<string>, IReadOnlyList<int>?, AskMultiChoiceOptions?)

Prompts the user to select one or more options from a choice list.

ValueTask<IReadOnlyList<int>> AskMultiChoiceAsync(string name, string prompt, IReadOnlyList<string> choices, IReadOnlyList<int>? defaultIndices = null, AskMultiChoiceOptions? options = null)

Parameters

name string

Prompt name (used for prefill via --answer:name=1,3).

prompt string

Prompt text displayed to the user.

choices IReadOnlyList<string>

Available choices.

defaultIndices IReadOnlyList<int>

Indices of pre-selected choices, or null for none.

options AskMultiChoiceOptions

Optional multi-choice options (min/max selections, cancellation, timeout).

Returns

ValueTask<IReadOnlyList<int>>

The zero-based indices of the selected choices.

AskSecretAsync(string, string, AskSecretOptions?)

Prompts the user for a secret (masked input such as a password).

ValueTask<string> AskSecretAsync(string name, string prompt, AskSecretOptions? options = null)

Parameters

name string

Prompt name (used for prefill via --answer:name=value).

prompt string

Prompt text displayed to the user.

options AskSecretOptions

Optional secret-specific options (mask character, allow empty, cancellation, timeout).

Returns

ValueTask<string>

The captured secret text.

AskTextAsync(string, string, string?, AskOptions?)

Prompts the user for free-form text.

ValueTask<string> AskTextAsync(string name, string prompt, string? defaultValue = null, AskOptions? options = null)

Parameters

name string

Prompt name.

prompt string

Prompt text.

defaultValue string

Optional default value.

options AskOptions

Optional ask options (cancellation, timeout). When null or token is default, uses the ambient per-command token.

Returns

ValueTask<string>

The captured text.

ClearScreenAsync(CancellationToken)

Clears the terminal screen.

ValueTask ClearScreenAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

An asynchronous operation.

DispatchAsync<TResult>(InteractionRequest<TResult>, CancellationToken)

Dispatches a custom InteractionRequest<TResult> through the handler pipeline.

ValueTask<TResult> DispatchAsync<TResult>(InteractionRequest<TResult> request, CancellationToken cancellationToken)

Parameters

request InteractionRequest<TResult>

The interaction request.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<TResult>

The result produced by the first handler that handles the request.

Type Parameters

TResult

The expected result type.

Exceptions

NotSupportedException

No registered handler handled the request.

WriteProgressAsync(string, double?, CancellationToken)

Writes progress information.

ValueTask WriteProgressAsync(string label, double? percent, CancellationToken cancellationToken)

Parameters

label string

Progress label.

percent double?

Optional progress percent.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

An asynchronous operation.

WriteStatusAsync(string, CancellationToken)

Writes a status line.

ValueTask WriteStatusAsync(string text, CancellationToken cancellationToken)

Parameters

text string

Status text.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

An asynchronous operation.