Add method to write VT/ANSI control codes

Adds a new extension method IAnsiConsole.WriteAnsi that writes
VT/ANSI control codes to the console. If VT/ANSI control codes are
not supported, nothing will be written.
This commit is contained in:
Patrik Svensson
2021-04-22 22:11:21 +02:00
committed by Phil Scott
parent 91f910326c
commit 3463dde543
14 changed files with 212 additions and 101 deletions

View File

@ -17,6 +17,18 @@ namespace Spectre.Console.Testing
return console;
}
/// <summary>
/// Sets whether or not ANSI is supported.
/// </summary>
/// <param name="console">The console.</param>
/// <param name="enable">Whether or not VT/ANSI control codes are supported.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static TestConsole SupportsAnsi(this TestConsole console, bool enable)
{
console.Profile.Capabilities.Ansi = enable;
return console;
}
/// <summary>
/// Makes the console interactive.
/// </summary>