IReplInteractionChannel
Provides bidirectional interaction during command execution.
- Kind:
Interface - Namespace: Repl.Interaction
- Assembly:
Repl.Core - Source: src/Repl.Core/Interaction/IReplInteractionChannel.cs
Signature
Section titled “Signature”public interface IReplInteractionChannelExtension Methods
Section titled “Extension Methods”AskEnumAsync<TEnum>(IReplInteractionChannel, string, string, TEnum?, AskOptions)AskFlagsEnumAsync<TEnum>(IReplInteractionChannel, string, string, TEnum?, AskMultiChoiceOptions)AskNumberAsync<T>(IReplInteractionChannel, string, string, T?, AskNumberOptions<T>)AskValidatedTextAsync(IReplInteractionChannel, string, string, Func<string, string>, string, AskOptions)ClearProgressAsync(IReplInteractionChannel, CancellationToken)PressAnyKeyAsync(IReplInteractionChannel, string, CancellationToken)WriteErrorProgressAsync(IReplInteractionChannel, string, double?, string, CancellationToken)WriteIndeterminateProgressAsync(IReplInteractionChannel, string, string, CancellationToken)WriteNoticeAsync(IReplInteractionChannel, string, CancellationToken)WriteProblemAsync(IReplInteractionChannel, string, string, string, CancellationToken)WriteProgressAsync(IReplInteractionChannel, ReplProgressEvent, CancellationToken)WriteWarningAsync(IReplInteractionChannel, string, CancellationToken)WriteWarningProgressAsync(IReplInteractionChannel, string, double?, string, CancellationToken)
Methods
Section titled “Methods”AskChoiceAsync(string, string, IReadOnlyList<string>, int?, AskOptions?)
Section titled “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
Section titled “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
Section titled “Returns”ValueTask<int> - The zero-based index of the selected choice.
AskConfirmationAsync(string, string, bool?, AskOptions?)
Section titled “AskConfirmationAsync(string, string, bool?, AskOptions?)”Prompts the user for confirmation.
ValueTask<bool> AskConfirmationAsync(string name, string prompt, bool? defaultValue = null, AskOptions? options = null)Parameters
Section titled “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
Section titled “Returns”ValueTask<bool> - True when confirmed.
AskMultiChoiceAsync(string, string, IReadOnlyList<string>, IReadOnlyList<int>?, AskMultiChoiceOptions?)
Section titled “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
Section titled “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, ornullfor none.options(AskMultiChoiceOptions): Optional multi-choice options (min/max selections, cancellation, timeout).
Returns
Section titled “Returns”ValueTask<IReadOnlyList<int>> - The zero-based indices of the selected choices.
AskSecretAsync(string, string, AskSecretOptions?)
Section titled “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
Section titled “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
Section titled “Returns”ValueTask<string> - The captured secret text.
AskTextAsync(string, string, string?, AskOptions?)
Section titled “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
Section titled “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
Section titled “Returns”ValueTask<string> - The captured text.
ClearScreenAsync(CancellationToken)
Section titled “ClearScreenAsync(CancellationToken)”Clears the terminal screen.
ValueTask ClearScreenAsync(CancellationToken cancellationToken)Parameters
Section titled “Parameters”cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask - An asynchronous operation.
DispatchAsync<TResult>(InteractionRequest<TResult>, CancellationToken)
Section titled “DispatchAsync<TResult>(InteractionRequest<TResult>, CancellationToken)”Dispatches a custom InteractionRequest<TResult> through the handler pipeline.
ValueTask<TResult> DispatchAsync<TResult>(InteractionRequest<TResult> request, CancellationToken cancellationToken)Type Parameters
Section titled “Type Parameters”TResult: The expected result type.
Parameters
Section titled “Parameters”request(InteractionRequest<TResult>): The interaction request.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<TResult> - The result produced by the first handler that handles the request.
WriteProgressAsync(string, double?, CancellationToken)
Section titled “WriteProgressAsync(string, double?, CancellationToken)”Writes progress information.
ValueTask WriteProgressAsync(string label, double? percent, CancellationToken cancellationToken)Parameters
Section titled “Parameters”label(string): Progress label.percent(double?): Optional progress percent.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask - An asynchronous operation.
WriteStatusAsync(string, CancellationToken)
Section titled “WriteStatusAsync(string, CancellationToken)”Writes a status line.
ValueTask WriteStatusAsync(string text, CancellationToken cancellationToken)Parameters
Section titled “Parameters”text(string): Status text.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask - An asynchronous operation.