From de2cfdb632401bfe29ef86c29e4b2da4aac349d0 Mon Sep 17 00:00:00 2001 From: Eveldee Date: Fri, 4 Jun 2021 20:39:41 +0200 Subject: [PATCH] Add Spectre.Console support --- .../Akari.Prototype.Server.csproj | 1 + .../Utils/ConsoleExtensions.cs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Akari.Prototype.Server/Utils/ConsoleExtensions.cs diff --git a/Akari.Prototype.Server/Akari.Prototype.Server.csproj b/Akari.Prototype.Server/Akari.Prototype.Server.csproj index f3d3904..c7e1787 100644 --- a/Akari.Prototype.Server/Akari.Prototype.Server.csproj +++ b/Akari.Prototype.Server/Akari.Prototype.Server.csproj @@ -12,6 +12,7 @@ + diff --git a/Akari.Prototype.Server/Utils/ConsoleExtensions.cs b/Akari.Prototype.Server/Utils/ConsoleExtensions.cs new file mode 100644 index 0000000..f97bcd4 --- /dev/null +++ b/Akari.Prototype.Server/Utils/ConsoleExtensions.cs @@ -0,0 +1,19 @@ +using CliFx.Infrastructure; +using Spectre.Console; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Akari.Prototype.Server.Utils +{ + public static class ConsoleExtensions + { + public static IAnsiConsole AsAnsiConsole(this IConsole console) => AnsiConsole.Create(new AnsiConsoleSettings + { + Ansi = AnsiSupport.Detect, + ColorSystem = ColorSystemSupport.Detect, + Out = new AnsiConsoleOutput(console.Output) + }); + } +}