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.
public FormattableString GetMessageText(FormattableString? message, string? markupTag = null, IFormatProvider? formatProvider = null)
Parameters
messageFormattableStringThe message to format. Can be null.
markupTagstringOptional markup tag to apply to the message (e.g., "b" for bold, "i" for italic).
formatProviderIFormatProviderThe format provider to apply, or null to use the current culture.
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.
public string? GetMessageText<TMessage>(TMessage? message, string? markupTag = null, IFormatProvider? formatProvider = null)
Parameters
messageTMessageThe message to format. Can be null.
markupTagstringOptional markup tag to apply to the message (e.g., "b" for bold, "i" for italic).
formatProviderIFormatProviderThe format provider to apply, or null to use the current culture.
Returns
- string
A formatted string with applied markup, or an empty string if the input is null.
Type Parameters
TMessageThe type of the message to format.