Skip to content

SpectreReplExtensions

Extension methods to enable Spectre.Console integration in a Repl application.

public static class SpectreReplExtensions

Registers Spectre.Console services: SpectreInteractionHandler for rich prompts and IAnsiConsole for direct injection into commands.

public static IServiceCollection AddSpectreConsole(this IServiceCollection services)

IServiceCollection - The same service collection for chaining.

UseSpectreConsole(ReplApp, Action<SpectreConsoleOptions>?)

Section titled “UseSpectreConsole(ReplApp, Action<SpectreConsoleOptions>?)”

Enables Spectre.Console output rendering by registering the “spectre” output transformer and setting it as the default format. Also registers the SpectreInteractionHandler and IAnsiConsole DI service.

public static ReplApp UseSpectreConsole(this ReplApp app, Action<SpectreConsoleOptions>? configure = null)
  • app (ReplApp): Target REPL application.
  • configure (Action<SpectreConsoleOptions>): Optional callback to configure Spectre console options.

ReplApp - The same app instance for chaining.