Table of Contents

Class ServiceCollectionOutputExtensions

Namespace
Ploch.CommandLine.Spectre.Output
Assembly
Ploch.CommandLine.Spectre.dll

Extension methods for IServiceCollection to register message formatters and writers.

public static class ServiceCollectionOutputExtensions
Inheritance
ServiceCollectionOutputExtensions
Inherited Members

Remarks

MessageFormatterProcessor selects the handler whose message type is the most derived among those that accept a message, and of two handlers for the same type it uses the later registration. The built-in handlers are registered by the output services bundle before any ConfigureServices delegate runs, so registering a handler for a type the bundle already covers - such as string, FormattableString, Exception or IEnumerable - replaces the built-in one for that type.

Methods

AddMessageFormatter<TMessageType, TFormatter>(IServiceCollection)

Registers a message formatter for a specific message type in the service collection.

AddMessageWriter<TMessageType, TWriter>(IServiceCollection)

Registers a message writer for a specific message type in the service collection.