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.

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

Parameters

message FormattableString

The message to format. Can be 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

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

message TMessage

The message to format. Can be 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 an empty string if the input is null.

Type Parameters

TMessage

The type of the message to format.