namespace Spectre.Console;
///
/// Contains extension methods for .
///
public static class HasTableBorderExtensions
{
///
/// Do not display a border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T NoBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.None);
}
///
/// Display a square border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T SquareBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Square);
}
///
/// Display an ASCII border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T AsciiBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Ascii);
}
///
/// Display another ASCII border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T Ascii2Border(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Ascii2);
}
///
/// Display an ASCII border with a double header border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T AsciiDoubleHeadBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.AsciiDoubleHead);
}
///
/// Display a rounded border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T RoundedBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Rounded);
}
///
/// Display a minimal border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T MinimalBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Minimal);
}
///
/// Display a minimal border with a heavy head.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T MinimalHeavyHeadBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.MinimalHeavyHead);
}
///
/// Display a minimal border with a double header border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T MinimalDoubleHeadBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.MinimalDoubleHead);
}
///
/// Display a simple border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T SimpleBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Simple);
}
///
/// Display a simple border with heavy lines.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T SimpleHeavyBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.SimpleHeavy);
}
///
/// Display a simple border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T HorizontalBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Horizontal);
}
///
/// Display a heavy border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T HeavyBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Heavy);
}
///
/// Display a border with a heavy edge.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T HeavyEdgeBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.HeavyEdge);
}
///
/// Display a border with a heavy header.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T HeavyHeadBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.HeavyHead);
}
///
/// Display a double border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T DoubleBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Double);
}
///
/// Display a border with a double edge.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T DoubleEdgeBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.DoubleEdge);
}
///
/// Display a markdown border.
///
/// An object type with a border.
/// The object to set the border for.
/// The same instance so that multiple calls can be chained.
public static T MarkdownBorder(this T obj)
where T : class, IHasTableBorder
{
return Border(obj, TableBorder.Markdown);
}
///
/// Sets the border.
///
/// An object type with a border.
/// The object to set the border for.
/// The border to use.
/// The same instance so that multiple calls can be chained.
public static T Border(this T obj, TableBorder border)
where T : class, IHasTableBorder
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.Border = border;
return obj;
}
}