Skip to content

IReplInteractionChannel

Provides bidirectional interaction during command execution.

public interface IReplInteractionChannel
  • 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)

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)
  • 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.

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)
  • 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.

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)
  • 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).

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)
  • 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).

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)
  • 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.

ValueTask<string> - The captured text.

Clears the terminal screen.

ValueTask ClearScreenAsync(CancellationToken cancellationToken)

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)
  • TResult: The expected result type.
  • request (InteractionRequest<TResult>): The interaction request.
  • cancellationToken (CancellationToken): Cancellation token.

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)
  • label (string): Progress label.
  • percent (double?): Optional progress percent.
  • cancellationToken (CancellationToken): Cancellation token.

ValueTask - An asynchronous operation.

WriteStatusAsync(string, CancellationToken)

Section titled “WriteStatusAsync(string, CancellationToken)”

Writes a status line.

ValueTask WriteStatusAsync(string text, CancellationToken cancellationToken)

ValueTask - An asynchronous operation.