Skip to content

ReplInteractionChannelExtensions

Extension methods that compose on top of IReplInteractionChannel primitives.

public static class ReplInteractionChannelExtensions

AskEnumAsync<TEnum>(IReplInteractionChannel, string, string, TEnum?, AskOptions?)

Section titled “AskEnumAsync<TEnum>(IReplInteractionChannel, string, string, TEnum?, AskOptions?)”

Prompts the user to select a value from an enum type. Uses DescriptionAttribute or DisplayAttribute names when present, otherwise humanizes the enum member name (CamelCase becomes Camel case).

public static ValueTask<TEnum> AskEnumAsync<TEnum>(this IReplInteractionChannel channel, string name, string prompt, TEnum? defaultValue = null, AskOptions? options = null) where TEnum : struct, Enum
  • TEnum

ValueTask<TEnum>

AskFlagsEnumAsync<TEnum>(IReplInteractionChannel, string, string, TEnum?, AskMultiChoiceOptions?)

Section titled “AskFlagsEnumAsync<TEnum>(IReplInteractionChannel, string, string, TEnum?, AskMultiChoiceOptions?)”

Prompts the user to select one or more values from a [Flags] enum type.

public static ValueTask<TEnum> AskFlagsEnumAsync<TEnum>(this IReplInteractionChannel channel, string name, string prompt, TEnum? defaultValue = null, AskMultiChoiceOptions? options = null) where TEnum : struct, Enum
  • TEnum

ValueTask<TEnum>

AskNumberAsync<T>(IReplInteractionChannel, string, string, T?, AskNumberOptions<T>?)

Section titled “AskNumberAsync<T>(IReplInteractionChannel, string, string, T?, AskNumberOptions<T>?)”

Prompts the user for a typed numeric value with optional min/max bounds.

public static ValueTask<T> AskNumberAsync<T>(this IReplInteractionChannel channel, string name, string prompt, T? defaultValue = null, AskNumberOptions<T>? options = null) where T : struct, INumber<T>, IParsable<T>
  • T

ValueTask<T>

AskValidatedTextAsync(IReplInteractionChannel, string, string, Func<string, string?>, string?, AskOptions?)

Section titled “AskValidatedTextAsync(IReplInteractionChannel, string, string, Func<string, string?>, string?, AskOptions?)”

Prompts the user for text with inline validation. Re-prompts until the validator returns null (meaning valid).

public static ValueTask<string> AskValidatedTextAsync(this IReplInteractionChannel channel, string name, string prompt, Func<string, string?> validate, string? defaultValue = null, AskOptions? options = null)
  • channel (IReplInteractionChannel): The interaction channel.
  • name (string): Prompt name.
  • prompt (string): Prompt text.
  • validate (Func<string, string>): Validator function. Returns null when the input is valid, or an error message string otherwise.
  • defaultValue (string): Optional default value.
  • options (AskOptions): Optional ask options.

ValueTask<string> - The validated text.

ClearProgressAsync(IReplInteractionChannel, CancellationToken)

Section titled “ClearProgressAsync(IReplInteractionChannel, CancellationToken)”

Clears any currently visible progress indicator.

public static ValueTask ClearProgressAsync(this IReplInteractionChannel channel, CancellationToken cancellationToken = default)

ValueTask

PressAnyKeyAsync(IReplInteractionChannel, string, CancellationToken)

Section titled “PressAnyKeyAsync(IReplInteractionChannel, string, CancellationToken)”

Displays a message and waits for the user to press any key.

public static ValueTask PressAnyKeyAsync(this IReplInteractionChannel channel, string prompt = "Press any key to continue...", CancellationToken cancellationToken = default)

ValueTask

WriteErrorProgressAsync(IReplInteractionChannel, string, double?, string?, CancellationToken)

Section titled “WriteErrorProgressAsync(IReplInteractionChannel, string, double?, string?, CancellationToken)”

Writes an error-state progress update.

public static ValueTask WriteErrorProgressAsync(this IReplInteractionChannel channel, string label, double? percent = null, string? details = null, CancellationToken cancellationToken = default)

ValueTask

WriteIndeterminateProgressAsync(IReplInteractionChannel, string, string?, CancellationToken)

Section titled “WriteIndeterminateProgressAsync(IReplInteractionChannel, string, string?, CancellationToken)”

Writes an indeterminate progress update.

public static ValueTask WriteIndeterminateProgressAsync(this IReplInteractionChannel channel, string label, string? details = null, CancellationToken cancellationToken = default)

ValueTask

WriteNoticeAsync(IReplInteractionChannel, string, CancellationToken)

Section titled “WriteNoticeAsync(IReplInteractionChannel, string, CancellationToken)”

Writes an informational user-facing notice.

public static ValueTask WriteNoticeAsync(this IReplInteractionChannel channel, string text, CancellationToken cancellationToken = default)

ValueTask

WriteProblemAsync(IReplInteractionChannel, string, string?, string?, CancellationToken)

Section titled “WriteProblemAsync(IReplInteractionChannel, string, string?, string?, CancellationToken)”

Writes a user-facing problem summary.

public static ValueTask WriteProblemAsync(this IReplInteractionChannel channel, string summary, string? details = null, string? code = null, CancellationToken cancellationToken = default)

ValueTask

WriteProgressAsync(IReplInteractionChannel, ReplProgressEvent, CancellationToken)

Section titled “WriteProgressAsync(IReplInteractionChannel, ReplProgressEvent, CancellationToken)”

Writes a structured progress update.

public static ValueTask WriteProgressAsync(this IReplInteractionChannel channel, ReplProgressEvent progress, CancellationToken cancellationToken = default)

ValueTask

WriteWarningAsync(IReplInteractionChannel, string, CancellationToken)

Section titled “WriteWarningAsync(IReplInteractionChannel, string, CancellationToken)”

Writes a user-facing warning.

public static ValueTask WriteWarningAsync(this IReplInteractionChannel channel, string text, CancellationToken cancellationToken = default)

ValueTask

WriteWarningProgressAsync(IReplInteractionChannel, string, double?, string?, CancellationToken)

Section titled “WriteWarningProgressAsync(IReplInteractionChannel, string, double?, string?, CancellationToken)”

Writes a warning-state progress update.

public static ValueTask WriteWarningProgressAsync(this IReplInteractionChannel channel, string label, double? percent = null, string? details = null, CancellationToken cancellationToken = default)

ValueTask