Table of Contents

Method Configure

Namespace
Ploch.CommandLine.Spectre.Configuration
Assembly
Ploch.CommandLine.Spectre.dll

Configure(IConfiguration)

Configures the service collection with required services for a Spectre.Console-based command-line application.

protected override void Configure(IConfiguration configuration)

Parameters

configuration IConfiguration

The configuration supplied to the bundle.

Remarks

This method registers:

  • Spectre.Console input, cursor, exclusivity mode, and profile as singletons
  • CommandArgumentsRootProcessor and the TokensArgumentsProcessor implementation of ICommandSettingsProcessor as transient services, so each resolution receives a fresh instance
  • Command settings validation and exception handling services as singletons
  • The logging services, so that ILogger<T> resolves even when the bundle is used outside a host. No provider is added here: the host supplies its defaults, and Serilog is registered only by the Ploch.CommandLine.Spectre.Serilog package when the application opts in.