[CLI] Update CliFx and use Spectre.Console for progress reporting

This commit is contained in:
Tyrrrz
2021-03-23 22:38:44 +02:00
parent 6f90c367b9
commit 017ed5ae6d
13 changed files with 193 additions and 121 deletions

View File

@@ -0,0 +1,30 @@
using CliFx.Infrastructure;
using Spectre.Console;
namespace DiscordChatExporter.Cli.Utils.Extensions
{
internal static class ConsoleExtensions
{
public static IAnsiConsole CreateAnsiConsole(this IConsole console) => AnsiConsole.Create(
new AnsiConsoleSettings
{
Ansi = AnsiSupport.Detect,
ColorSystem = ColorSystemSupport.Detect,
Out = console.Output
}
);
public static Progress CreateProgressTicker(this IConsole console) => console
.CreateAnsiConsole()
.Progress()
.AutoClear(false)
.AutoRefresh(true)
.HideCompleted(false)
.Columns(new ProgressColumn[]
{
new TaskDescriptionColumn {Alignment = Justify.Left},
new ProgressBarColumn(),
new PercentageColumn()
});
}
}