Add Progress.HideCompleted

This commit is contained in:
stf
2021-03-03 21:58:38 +01:00
committed by Phil Scott
parent 1cd335e785
commit 1c769c6610
4 changed files with 63 additions and 3 deletions

View File

@ -75,5 +75,25 @@ namespace Spectre.Console
return progress;
}
/// <summary>
/// Sets whether or not hide completed is enabled.
/// If enabled, the task tabled will be removed once it is
/// completed.
/// </summary>
/// <param name="progress">The <see cref="Progress"/> instance.</param>
/// <param name="enabled">Whether or not hide completed is enabled.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Progress HideCompleted(this Progress progress, bool enabled)
{
if (progress is null)
{
throw new ArgumentNullException(nameof(progress));
}
progress.HideCompleted = enabled;
return progress;
}
}
}