Table of Contents

Method GetMessageText

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

GetMessageText(FormattableString?, string?, IFormatProvider?)

Formats a message as a FormattableString with optional markup.

FormattableString GetMessageText(FormattableString? message, string? markupTag = null, IFormatProvider? formatProvider = null)

Parameters

message FormattableString

The message to format, or null.

markupTag string

Optional markup tag to apply to the message (e.g., "b" for bold, "i" for italic).

formatProvider IFormatProvider

The format provider forwarded to the formatter selected for each interpolated argument, or null to use the current culture. A FormattableString cannot carry a provider, so a caller that materialises the result must supply the provider again at that point.

Returns

FormattableString

A formatted string with applied markup, or an empty string if the input is null.

GetMessageText<TMessage>(TMessage?, string?, IFormatProvider?)

Formats a message of type TMessage with optional markup.

string? GetMessageText<TMessage>(TMessage? message, string? markupTag = null, IFormatProvider? formatProvider = null)

Parameters

message TMessage

The message to format, or null.

markupTag string

Optional markup tag to apply to the message (e.g., "b" for bold, "i" for italic).

formatProvider IFormatProvider

The format provider to apply, or null to use the current culture.

Returns

string

A formatted string with applied markup, or null if the input is null.

Type Parameters

TMessage

The type of the message to format.