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
namestringPrompt name.
promptstringPrompt text.
choicesIReadOnlyList<string>Selectable choices.
defaultIndexint?Index of the default choice returned on empty input, or null to use the first choice.
optionsAskOptionsOptional ask options (cancellation, timeout). When null or token is default, uses the ambient per-command token.
Returns
AskConfirmationAsync(string, string, bool?, AskOptions?)
Prompts the user for confirmation.
ValueTask<bool> AskConfirmationAsync(string name, string prompt, bool? defaultValue = null, AskOptions? options = null)
Parameters
namestringPrompt name.
promptstringPrompt text.
defaultValuebool?Default choice.
optionsAskOptionsOptional ask options (cancellation, timeout). When null or token is default, uses the ambient per-command token.
Returns
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
namestringPrompt name (used for prefill via
--answer:name=1,3).promptstringPrompt text displayed to the user.
choicesIReadOnlyList<string>Available choices.
defaultIndicesIReadOnlyList<int>Indices of pre-selected choices, or
nullfor none.optionsAskMultiChoiceOptionsOptional 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
namestringPrompt name (used for prefill via
--answer:name=value).promptstringPrompt text displayed to the user.
optionsAskSecretOptionsOptional secret-specific options (mask character, allow empty, cancellation, timeout).
Returns
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
namestringPrompt name.
promptstringPrompt text.
defaultValuestringOptional default value.
optionsAskOptionsOptional ask options (cancellation, timeout). When null or token is default, uses the ambient per-command token.
Returns
ClearScreenAsync(CancellationToken)
Clears the terminal screen.
ValueTask ClearScreenAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation 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
requestInteractionRequest<TResult>The interaction request.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<TResult>
The result produced by the first handler that handles the request.
Type Parameters
TResultThe 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
labelstringProgress label.
percentdouble?Optional progress percent.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask
An asynchronous operation.
WriteStatusAsync(string, CancellationToken)
Writes a status line.
ValueTask WriteStatusAsync(string text, CancellationToken cancellationToken)
Parameters
textstringStatus text.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask
An asynchronous operation.