forked from sim0n00ps/OF-DL
17 lines
579 B
C#
17 lines
579 B
C#
using OF_DL.Services;
|
|
using Spectre.Console;
|
|
|
|
namespace OF_DL.CLI;
|
|
|
|
/// <summary>
|
|
/// Implementation of IProgressReporter that uses Spectre.Console's ProgressTask for CLI output.
|
|
/// </summary>
|
|
public class SpectreProgressReporter(ProgressTask task, CancellationToken cancellationToken = default) : IProgressReporter
|
|
{
|
|
private readonly ProgressTask _task = task ?? throw new ArgumentNullException(nameof(task));
|
|
|
|
public CancellationToken CancellationToken { get; } = cancellationToken;
|
|
|
|
public void ReportProgress(long increment) => _task.Increment(increment);
|
|
}
|