Class AnsiConsoleMarkupOutput
- Namespace
- Ploch.CommandLine.Spectre.Output
- Assembly
- Ploch.CommandLine.Spectre.dll
Provides an implementation of IOutput that uses Spectre.Console's ANSI console for markup-enabled output.
public class AnsiConsoleMarkupOutput : IOutput
- Inheritance
-
AnsiConsoleMarkupOutput
- Implements
- Inherited Members
Remarks
Markup is parsed only where the caller asks for it: Markup(string), MarkupLine(string),
MarkupInterpolated(FormattableString), MarkupLineInterpolated(FormattableString) and, by default through
FormattableStringMessageWriter, a FormattableString passed to
Write<TMessage>(TMessage, IFormatProvider?) or WriteLine<TMessage>(TMessage). A plain string is written
verbatim, which mirrors the split Spectre.Console itself makes between IAnsiConsole.Write(string) and
IAnsiConsole.Markup(string).
Write<TMessage>(TMessage, IFormatProvider?) and WriteLine<TMessage>(TMessage) render an Spectre.Console.Rendering.IRenderable through the console and hand every other message to the registered IMessageWriter instances, including a string and a FormattableString: the built-in StringMessageWriter and FormattableStringMessageWriter are what write them, so a consumer that registers a writer for either type changes how that type renders. Only a message no writer accepts falls back to this class's own text rendering.
Constructors
- AnsiConsoleMarkupOutput(IAnsiConsole, IMessageFormatterProcessor)
Provides an implementation of IOutput that uses Spectre.Console's ANSI console for markup-enabled output.
Methods
- EndLine()
Writes a line terminator to the console.
- Markup(string)
Writes a string that is parsed as Spectre.Console markup to the console.
- MarkupInterpolated(FormattableString)
Writes a markup-enabled interpolated string to the console.
- MarkupLine(string)
Writes a string that is parsed as Spectre.Console markup to the console, followed by a line terminator.
- MarkupLineInterpolated(FormattableString)
Writes a markup-enabled interpolated string followed by a line terminator to the console.
- Write(IRenderable)
Writes a renderable object to the console.
- WriteBoldLine<TMessage>(TMessage?)
Writes a message in bold formatting followed by a line terminator to the console.
- WriteBold<TMessage>(TMessage?)
Writes a message in bold formatting to the console.
- WriteErrorLine<TMessage>(TMessage?)
Writes an error message in red formatting followed by a line terminator to the console.
- WriteError<TMessage>(TMessage?)
Writes an error message in red formatting to the console.
- WriteException<TException>(TException?)
Writes an exception with detailed formatting to the console.
- WriteLine()
Writes a line terminator to the console.
- WriteLine<TMessage>(TMessage)
Writes a message followed by a line terminator to the console.
- Write<TMessage>(TMessage, IFormatProvider?)
Writes a message to the console with appropriate formatting based on the message type.