Make it possible to set Value directly

This commit is contained in:
Oskar Klintrot
2021-02-25 11:19:28 +01:00
committed by Patrik Svensson
parent 3a42c0a119
commit c64884854f
3 changed files with 104 additions and 7 deletions

View File

@ -40,5 +40,22 @@ namespace Spectre.Console
task.MaxValue = value;
return task;
}
/// <summary>
/// Sets the value of the task.
/// </summary>
/// <param name="task">The task.</param>
/// <param name="value">The value.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static ProgressTask Value(this ProgressTask task, double value)
{
if (task is null)
{
throw new ArgumentNullException(nameof(task));
}
task.Value = value;
return task;
}
}
}