Skip to content

bojordan/SpectreHelpers

Repository files navigation

SpectreHelpers

NuGet

SpectreHelpers is a collection of helper extensions for Spectre.Console that simplify common console application patterns, especially progress tracking with multiple concurrent tasks.


Installation

Install via NuGet:

dotnet add package 130Widgets.SpectreHelpers

For C# scripts (dotnet run app.cs):

#:package 130Widgets.SpectreHelpers@[1.0.0, 2.0.0)

Usage

The helpers make it easy to add and run multiple progress tasks in parallel:

using Spectre.Console;

await AnsiConsole.Progress()
    .AddTask("Task 1", async progressTask =>
    {
        progressTask.Increment(10);
        await Task.Delay(500);
    })
    .AddTask("Task 2", async progressTask =>
    {
        while (!progressTask.IsFinished)
        {
            await Task.Delay(250);
            progressTask.Increment(10);
        }
    })
    .StartAsync();

Examples


License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Helper methods for use with Spectre.Console https://spectreconsole.net/

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages