Clean up status related code a bit

This commit is contained in:
Patrik Svensson
2020-12-09 08:23:44 +01:00
committed by Patrik Svensson
parent 501db5d287
commit acf01e056f
12 changed files with 9 additions and 56 deletions

View File

@@ -0,0 +1,44 @@
using System;
namespace Spectre.Console
{
/// <summary>
/// Contains extension methods for <see cref="ProgressTask"/>.
/// </summary>
public static class ProgressTaskExtensions
{
/// <summary>
/// Sets the task description.
/// </summary>
/// <param name="task">The task.</param>
/// <param name="description">The description.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static ProgressTask Description(this ProgressTask task, string description)
{
if (task is null)
{
throw new ArgumentNullException(nameof(task));
}
task.Description = description;
return task;
}
/// <summary>
/// Sets the max value of the task.
/// </summary>
/// <param name="task">The task.</param>
/// <param name="value">The max value.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static ProgressTask MaxValue(this ProgressTask task, double value)
{
if (task is null)
{
throw new ArgumentNullException(nameof(task));
}
task.MaxValue = value;
return task;
}
}
}