VirtualTerminalWriteLineErrorFormatted Method

Writes a line to the standard error stream which, if virtual terminal sequences are supported, will use the specified formatting.

Definition

Namespace: Ookii.CommandLine.Terminal
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public static void WriteLineErrorFormatted(
	string text,
	TextFormat? textFormat = null,
	TextFormat? reset = null
)

Parameters

text  String
The text to write.
textFormat  NullableTextFormat  (Optional)
The formatting that should be applied to the text, or to use TextFormatForegroundRed.
reset  NullableTextFormat  (Optional)
The VT sequence that should be used to undo the formatting, or to use TextFormatDefault.

Remarks

This method takes care of checking whether VT sequences are supported by using the EnableColor(StandardStream) method, and on Windows, will reset the console mode afterwards if needed.

The textFormat and reset parameters will be ignored if the standard error stream does not support VT sequences. In that case, the value of text will be written without formatting.

This method uses the LineWrappingTextWriter to ensure that the text is properly white-space wrapped at the console width.

See Also