Added autoinstall for modules

This commit is contained in:
2024-07-14 21:24:49 +03:00
parent 3f8590b8f3
commit 13900bb3f3
10 changed files with 153 additions and 40 deletions

View File

@@ -46,4 +46,22 @@ internal static class ConsoleUtilities
}
public static async Task ExecuteTaskWithBuiltInProgress(Func<IProgress<float>, Task> method, string taskMessage)
{
await AnsiConsole.Progress()
.AutoClear(false) // Do not remove the task list when done
.HideCompleted(false) // Hide tasks as they are completed
.Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn())
.StartAsync(
async ctx =>
{
var task = ctx.AddTask(taskMessage);
IProgress<float> progress = new Progress<float>(x => task.Value = x);
await method(progress);
task.Value = 100;
}
);
}
}