Add support for tables

This commit is contained in:
Patrik Svensson
2020-08-04 16:05:57 +02:00
committed by Patrik Svensson
parent aa34c145b9
commit a068fc68c3
19 changed files with 837 additions and 33 deletions

View File

@@ -16,16 +16,27 @@ namespace Spectre.Console
/// </summary>
public ColorSystem ColorSystem { get; }
internal Capabilities(bool supportsAnsi, ColorSystem colorSystem)
/// <summary>
/// Gets a value indicating whether or not
/// this is a legacy console (cmd.exe).
/// </summary>
/// <remarks>
/// Only relevant when running on Microsoft Windows.
/// </remarks>
public bool LegacyConsole { get; }
internal Capabilities(bool supportsAnsi, ColorSystem colorSystem, bool legacyConsole)
{
SupportsAnsi = supportsAnsi;
ColorSystem = colorSystem;
LegacyConsole = legacyConsole;
}
/// <inheritdoc/>
public override string ToString()
{
var supportsAnsi = SupportsAnsi ? "Yes" : "No";
var legacyConsole = LegacyConsole ? "Legacy" : "Modern";
var bits = ColorSystem switch
{
ColorSystem.NoColors => "1 bit",
@@ -36,7 +47,7 @@ namespace Spectre.Console
_ => "?"
};
return $"ANSI={supportsAnsi}, Colors={ColorSystem} ({bits})";
return $"ANSI={supportsAnsi}, Colors={ColorSystem}, Kind={legacyConsole} ({bits})";
}
}
}