SpectreInteractionHandler
Handles interaction requests using Spectre.Console rich prompts. Returns Unhandled when the terminal does not support interactive Spectre prompts (hosted sessions, redirected input).
- Kind:
Class - Namespace: Repl.Spectre
- Assembly:
Repl.Spectre - Source: src/Repl.Spectre/SpectreInteractionHandler.cs
Signature
Section titled “Signature”public sealed class SpectreInteractionHandler : IReplInteractionHandlerInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Constructors
Section titled “Constructors”SpectreInteractionHandler()
Section titled “SpectreInteractionHandler()”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)Parameters
Section titled “Parameters”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.
Methods
Section titled “Methods”TryHandleAsync(InteractionRequest, CancellationToken)
Section titled “TryHandleAsync(InteractionRequest, CancellationToken)”Attempts to handle an interaction request.
public ValueTask<InteractionResult> TryHandleAsync(InteractionRequest request, CancellationToken cancellationToken)Parameters
Section titled “Parameters”request(InteractionRequest): The interaction request.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<InteractionResult> - Success(object) with the result value if handled,
or Unhandled to delegate to the next handler.