Skip to content

SpectreInteractionHandler

Handles interaction requests using Spectre.Console rich prompts. Returns Unhandled when the terminal does not support interactive Spectre prompts (hosted sessions, redirected input, colour forced where the terminal may not be driven), and while the command’s feedback goes elsewhere than the output the prompts draw on (output for a program, such as --json or a redirected standard output): the text prompts then take over.

public sealed class SpectreInteractionHandler : IReplInteractionHandler

Creates a handler whose prompt consoles fall back to Spectre-side terminal detection. Kept as a real parameterless constructor for consumers instantiating the handler without DI (and for binary compatibility with earlier versions).

public SpectreInteractionHandler()

SpectreInteractionHandler(OutputOptions?, SpectreConsoleOptions?)

Section titled “SpectreInteractionHandler(OutputOptions?, SpectreConsoleOptions?)”

Creates a handler whose prompt consoles follow the host terminal detection.

public SpectreInteractionHandler(OutputOptions? outputOptions, SpectreConsoleOptions? spectreOptions)
  • outputOptions (OutputOptions): Host output options driving terminal detection for the prompt consoles; resolved from DI when available.
  • spectreOptions (SpectreConsoleOptions): Per-app Spectre options (Unicode); resolved from DI when available.

TryHandleAsync(InteractionRequest, CancellationToken)

Section titled “TryHandleAsync(InteractionRequest, CancellationToken)”

Attempts to handle an interaction request.

public ValueTask<InteractionResult> TryHandleAsync(InteractionRequest request, CancellationToken cancellationToken)

ValueTask<InteractionResult> - Success(object) with the result value if handled, or Unhandled to delegate to the next handler.