namespace Spectre.Console;
///
/// Contains extension methods for .
///
public static class ExpandableExtensions
{
///
/// Tells the specified object to not expand to the available area
/// but take as little space as possible.
///
/// The expandable object.
/// The object to collapse.
/// The same instance so that multiple calls can be chained.
public static T Collapse(this T obj)
where T : class, IExpandable
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.Expand = false;
return obj;
}
///
/// Tells the specified object to expand to the available area.
///
/// The expandable object.
/// The object to expand.
/// The same instance so that multiple calls can be chained.
public static T Expand(this T obj)
where T : class, IExpandable
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.Expand = true;
return obj;
}
}