Compare commits

..

5 Commits

Author SHA1 Message Date
Patrik Svensson
e6e9a4d950 Add description for 'Info' example 2020-09-05 08:52:06 +02:00
Patrik Svensson
29ce14e1e8 Rename 'Diagnostic' example to 'Info' 2020-09-05 08:50:00 +02:00
Patrik Svensson
ceb3572d6a Make table and grid extension methods fluent 2020-09-05 08:49:36 +02:00
Patrik Svensson
13c56eca01 Allow mutation of segments 2020-09-05 08:39:48 +02:00
Patrik Svensson
a477884d36 Move Panel extensions to Spectre.Console namespace 2020-09-05 08:20:13 +02:00
12 changed files with 136 additions and 98 deletions

View File

@@ -4,6 +4,7 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Description>Demonstrates how to render data into columns.</Description>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -5,7 +5,6 @@ using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Spectre.Console; using Spectre.Console;
using Spectre.Console.Rendering;
namespace ColumnsExample namespace ColumnsExample
{ {

View File

@@ -1,17 +0,0 @@
using Spectre.Console;
namespace Diagnostic
{
public static class Program
{
public static void Main()
{
AnsiConsole.MarkupLine("Color system: [bold]{0}[/]", AnsiConsole.Capabilities.ColorSystem);
AnsiConsole.MarkupLine("Supports ansi? [bold]{0}[/]", AnsiConsole.Capabilities.SupportsAnsi);
AnsiConsole.MarkupLine("Legacy console? [bold]{0}[/]", AnsiConsole.Capabilities.LegacyConsole);
AnsiConsole.WriteLine();
AnsiConsole.MarkupLine("Buffer width: [bold]{0}[/]", AnsiConsole.Console.Width);
AnsiConsole.MarkupLine("Buffer height: [bold]{0}[/]", AnsiConsole.Console.Height);
}
}
}

23
examples/Info/Program.cs Normal file
View File

@@ -0,0 +1,23 @@
using Spectre.Console;
namespace Info
{
public static class Program
{
public static void Main()
{
var grid = new Grid()
.AddColumn(new GridColumn().NoWrap().PadRight(4))
.AddColumn()
.AddRow("[b]Color system[/]", $"{AnsiConsole.Capabilities.ColorSystem}")
.AddRow("[b]Supports ansi?[/]", $"{AnsiConsole.Capabilities.SupportsAnsi}")
.AddRow("[b]Legacy console?[/]", $"{AnsiConsole.Capabilities.LegacyConsole}")
.AddRow("[b]Buffer width[/]", $"{AnsiConsole.Console.Width}")
.AddRow("[b]Buffer height[/]", $"{AnsiConsole.Console.Height}");
AnsiConsole.Render(
new Panel(grid)
.SetHeader("Information"));
}
}
}

View File

@@ -25,10 +25,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grid", "..\examples\Grid\Gr
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Colors", "..\examples\Colors\Colors.csproj", "{1F51C55C-BA4C-4856-9001-0F7924FFB179}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Colors", "..\examples\Colors\Colors.csproj", "{1F51C55C-BA4C-4856-9001-0F7924FFB179}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Diagnostic", "..\examples\Diagnostic\Diagnostic.csproj", "{4337F255-88E9-4408-81A3-DF1AF58AC753}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Columns", "..\examples\Columns\Columns.csproj", "{33357599-C79D-4299-888F-634E2C3EACEF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Columns", "..\examples\Columns\Columns.csproj", "{33357599-C79D-4299-888F-634E2C3EACEF}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Info", "..\examples\Info\Info.csproj", "{225CE0D4-06AB-411A-8D29-707504FE53B3}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -111,18 +111,6 @@ Global
{1F51C55C-BA4C-4856-9001-0F7924FFB179}.Release|x64.Build.0 = Release|Any CPU {1F51C55C-BA4C-4856-9001-0F7924FFB179}.Release|x64.Build.0 = Release|Any CPU
{1F51C55C-BA4C-4856-9001-0F7924FFB179}.Release|x86.ActiveCfg = Release|Any CPU {1F51C55C-BA4C-4856-9001-0F7924FFB179}.Release|x86.ActiveCfg = Release|Any CPU
{1F51C55C-BA4C-4856-9001-0F7924FFB179}.Release|x86.Build.0 = Release|Any CPU {1F51C55C-BA4C-4856-9001-0F7924FFB179}.Release|x86.Build.0 = Release|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Debug|x64.ActiveCfg = Debug|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Debug|x64.Build.0 = Debug|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Debug|x86.ActiveCfg = Debug|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Debug|x86.Build.0 = Debug|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Release|Any CPU.Build.0 = Release|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Release|x64.ActiveCfg = Release|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Release|x64.Build.0 = Release|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Release|x86.ActiveCfg = Release|Any CPU
{4337F255-88E9-4408-81A3-DF1AF58AC753}.Release|x86.Build.0 = Release|Any CPU
{33357599-C79D-4299-888F-634E2C3EACEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {33357599-C79D-4299-888F-634E2C3EACEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33357599-C79D-4299-888F-634E2C3EACEF}.Debug|Any CPU.Build.0 = Debug|Any CPU {33357599-C79D-4299-888F-634E2C3EACEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33357599-C79D-4299-888F-634E2C3EACEF}.Debug|x64.ActiveCfg = Debug|Any CPU {33357599-C79D-4299-888F-634E2C3EACEF}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -135,6 +123,18 @@ Global
{33357599-C79D-4299-888F-634E2C3EACEF}.Release|x64.Build.0 = Release|Any CPU {33357599-C79D-4299-888F-634E2C3EACEF}.Release|x64.Build.0 = Release|Any CPU
{33357599-C79D-4299-888F-634E2C3EACEF}.Release|x86.ActiveCfg = Release|Any CPU {33357599-C79D-4299-888F-634E2C3EACEF}.Release|x86.ActiveCfg = Release|Any CPU
{33357599-C79D-4299-888F-634E2C3EACEF}.Release|x86.Build.0 = Release|Any CPU {33357599-C79D-4299-888F-634E2C3EACEF}.Release|x86.Build.0 = Release|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Debug|x64.ActiveCfg = Debug|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Debug|x64.Build.0 = Debug|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Debug|x86.ActiveCfg = Debug|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Debug|x86.Build.0 = Debug|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Release|Any CPU.Build.0 = Release|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Release|x64.ActiveCfg = Release|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Release|x64.Build.0 = Release|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Release|x86.ActiveCfg = Release|Any CPU
{225CE0D4-06AB-411A-8D29-707504FE53B3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -144,8 +144,8 @@ Global
{BFF37228-B376-4ADD-9657-4E501F929713} = {F0575243-121F-4DEE-9F6B-246E26DC0844} {BFF37228-B376-4ADD-9657-4E501F929713} = {F0575243-121F-4DEE-9F6B-246E26DC0844}
{C7FF6FDB-FB59-4517-8669-521C96AB7323} = {F0575243-121F-4DEE-9F6B-246E26DC0844} {C7FF6FDB-FB59-4517-8669-521C96AB7323} = {F0575243-121F-4DEE-9F6B-246E26DC0844}
{1F51C55C-BA4C-4856-9001-0F7924FFB179} = {F0575243-121F-4DEE-9F6B-246E26DC0844} {1F51C55C-BA4C-4856-9001-0F7924FFB179} = {F0575243-121F-4DEE-9F6B-246E26DC0844}
{4337F255-88E9-4408-81A3-DF1AF58AC753} = {F0575243-121F-4DEE-9F6B-246E26DC0844}
{33357599-C79D-4299-888F-634E2C3EACEF} = {F0575243-121F-4DEE-9F6B-246E26DC0844} {33357599-C79D-4299-888F-634E2C3EACEF} = {F0575243-121F-4DEE-9F6B-246E26DC0844}
{225CE0D4-06AB-411A-8D29-707504FE53B3} = {F0575243-121F-4DEE-9F6B-246E26DC0844}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5729B071-67A0-48FB-8B1B-275E6822086C} SolutionGuid = {5729B071-67A0-48FB-8B1B-275E6822086C}

View File

@@ -57,16 +57,19 @@ namespace Spectre.Console
/// <summary> /// <summary>
/// Adds a column to the grid. /// Adds a column to the grid.
/// </summary> /// </summary>
public void AddColumn() /// <returns>The same instance so that multiple calls can be chained.</returns>
public Grid AddColumn()
{ {
AddColumn(new GridColumn()); AddColumn(new GridColumn());
return this;
} }
/// <summary> /// <summary>
/// Adds a column to the grid. /// Adds a column to the grid.
/// </summary> /// </summary>
/// <param name="column">The column to add.</param> /// <param name="column">The column to add.</param>
public void AddColumn(GridColumn column) /// <returns>The same instance so that multiple calls can be chained.</returns>
public Grid AddColumn(GridColumn column)
{ {
if (column is null) if (column is null)
{ {
@@ -88,13 +91,16 @@ namespace Spectre.Console
Padding = column.Padding, Padding = column.Padding,
Alignment = column.Alignment, Alignment = column.Alignment,
}); });
return this;
} }
/// <summary> /// <summary>
/// Adds a new row to the grid. /// Adds a new row to the grid.
/// </summary> /// </summary>
/// <param name="columns">The columns to add.</param> /// <param name="columns">The columns to add.</param>
public void AddRow(params IRenderable[] columns) /// <returns>The same instance so that multiple calls can be chained.</returns>
public Grid AddRow(params IRenderable[] columns)
{ {
if (columns is null) if (columns is null)
{ {
@@ -107,6 +113,7 @@ namespace Spectre.Console
} }
_table.AddRow(columns); _table.AddRow(columns);
return this;
} }
} }
} }

View File

@@ -15,7 +15,8 @@ namespace Spectre.Console
/// </summary> /// </summary>
/// <param name="grid">The grid to add the column to.</param> /// <param name="grid">The grid to add the column to.</param>
/// <param name="count">The number of columns to add.</param> /// <param name="count">The number of columns to add.</param>
public static void AddColumns(this Grid grid, int count) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Grid AddColumns(this Grid grid, int count)
{ {
if (grid is null) if (grid is null)
{ {
@@ -26,6 +27,8 @@ namespace Spectre.Console
{ {
grid.AddColumn(new GridColumn()); grid.AddColumn(new GridColumn());
} }
return grid;
} }
/// <summary> /// <summary>
@@ -33,7 +36,8 @@ namespace Spectre.Console
/// </summary> /// </summary>
/// <param name="grid">The grid to add the column to.</param> /// <param name="grid">The grid to add the column to.</param>
/// <param name="columns">The columns to add.</param> /// <param name="columns">The columns to add.</param>
public static void AddColumns(this Grid grid, params GridColumn[] columns) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Grid AddColumns(this Grid grid, params GridColumn[] columns)
{ {
if (grid is null) if (grid is null)
{ {
@@ -49,13 +53,16 @@ namespace Spectre.Console
{ {
grid.AddColumn(column); grid.AddColumn(column);
} }
return grid;
} }
/// <summary> /// <summary>
/// Adds an empty row to the grid. /// Adds an empty row to the grid.
/// </summary> /// </summary>
/// <param name="grid">The grid to add the row to.</param> /// <param name="grid">The grid to add the row to.</param>
public static void AddEmptyRow(this Grid grid) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Grid AddEmptyRow(this Grid grid)
{ {
if (grid is null) if (grid is null)
{ {
@@ -65,6 +72,8 @@ namespace Spectre.Console
var columns = new IRenderable[grid.ColumnCount]; var columns = new IRenderable[grid.ColumnCount];
Enumerable.Range(0, grid.ColumnCount).ForEach(index => columns[index] = Text.Empty); Enumerable.Range(0, grid.ColumnCount).ForEach(index => columns[index] = Text.Empty);
grid.AddRow(columns); grid.AddRow(columns);
return grid;
} }
/// <summary> /// <summary>
@@ -72,7 +81,8 @@ namespace Spectre.Console
/// </summary> /// </summary>
/// <param name="grid">The grid to add the row to.</param> /// <param name="grid">The grid to add the row to.</param>
/// <param name="columns">The columns to add.</param> /// <param name="columns">The columns to add.</param>
public static void AddRow(this Grid grid, params string[] columns) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Grid AddRow(this Grid grid, params string[] columns)
{ {
if (grid is null) if (grid is null)
{ {
@@ -85,6 +95,7 @@ namespace Spectre.Console
} }
grid.AddRow(columns.Select(column => new Markup(column)).ToArray()); grid.AddRow(columns.Select(column => new Markup(column)).ToArray());
return grid;
} }
} }
} }

View File

@@ -1,6 +1,6 @@
using System; using System;
namespace Spectre.Console.Rendering namespace Spectre.Console
{ {
/// <summary> /// <summary>
/// Contains extension methods for <see cref="Panel"/>. /// Contains extension methods for <see cref="Panel"/>.

View File

@@ -13,25 +13,10 @@ namespace Spectre.Console.Rendering
[DebuggerDisplay("{Text,nq}")] [DebuggerDisplay("{Text,nq}")]
public class Segment public class Segment
{ {
private readonly bool _mutable;
private string _text;
/// <summary> /// <summary>
/// Gets the segment text. /// Gets the segment text.
/// </summary> /// </summary>
public string Text public string Text { get; private set; }
{
get => _text;
private set
{
if (!_mutable)
{
throw new NotSupportedException();
}
_text = value;
}
}
/// <summary> /// <summary>
/// Gets a value indicating whether or not this is an expicit line break /// Gets a value indicating whether or not this is an expicit line break
@@ -54,12 +39,12 @@ namespace Spectre.Console.Rendering
/// <summary> /// <summary>
/// Gets a segment representing a line break. /// Gets a segment representing a line break.
/// </summary> /// </summary>
public static Segment LineBreak { get; } = new Segment(Environment.NewLine, Style.Plain, true, false); public static Segment LineBreak => new Segment(Environment.NewLine, Style.Plain, true);
/// <summary> /// <summary>
/// Gets an empty segment. /// Gets an empty segment.
/// </summary> /// </summary>
public static Segment Empty { get; } = new Segment(string.Empty, Style.Plain, false, false); public static Segment Empty => new Segment(string.Empty, Style.Plain, false);
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Segment"/> class. /// Initializes a new instance of the <see cref="Segment"/> class.
@@ -80,16 +65,14 @@ namespace Spectre.Console.Rendering
{ {
} }
private Segment(string text, Style style, bool lineBreak, bool mutable = true) private Segment(string text, Style style, bool lineBreak)
{ {
if (text is null) if (text is null)
{ {
throw new ArgumentNullException(nameof(text)); throw new ArgumentNullException(nameof(text));
} }
_mutable = mutable; Text = text.NormalizeLineEndings();
_text = text.NormalizeLineEndings();
Style = style; Style = style;
IsLineBreak = lineBreak; IsLineBreak = lineBreak;
IsWhiteSpace = string.IsNullOrWhiteSpace(text); IsWhiteSpace = string.IsNullOrWhiteSpace(text);

View File

@@ -72,7 +72,8 @@ namespace Spectre.Console
/// Adds a column to the table. /// Adds a column to the table.
/// </summary> /// </summary>
/// <param name="column">The column to add.</param> /// <param name="column">The column to add.</param>
public void AddColumn(TableColumn column) /// <returns>The same instance so that multiple calls can be chained.</returns>
public Table AddColumn(TableColumn column)
{ {
if (column is null) if (column is null)
{ {
@@ -85,40 +86,15 @@ namespace Spectre.Console
} }
_columns.Add(column); _columns.Add(column);
} return this;
/// <summary>
/// Adds multiple columns to the table.
/// </summary>
/// <param name="columns">The columns to add.</param>
public void AddColumns(params TableColumn[] columns)
{
if (columns is null)
{
throw new ArgumentNullException(nameof(columns));
}
foreach (var column in columns)
{
AddColumn(column);
}
}
/// <summary>
/// Adds an empty row to the table.
/// </summary>
public void AddEmptyRow()
{
var columns = new IRenderable[ColumnCount];
Enumerable.Range(0, ColumnCount).ForEach(index => columns[index] = Text.Empty);
AddRow(columns);
} }
/// <summary> /// <summary>
/// Adds a row to the table. /// Adds a row to the table.
/// </summary> /// </summary>
/// <param name="columns">The row columns to add.</param> /// <param name="columns">The row columns to add.</param>
public void AddRow(params IRenderable[] columns) /// <returns>The same instance so that multiple calls can be chained.</returns>
public Table AddRow(params IRenderable[] columns)
{ {
if (columns is null) if (columns is null)
{ {
@@ -138,6 +114,8 @@ namespace Spectre.Console
var diff = _columns.Count - columns.Length; var diff = _columns.Count - columns.Length;
Enumerable.Range(0, diff).ForEach(_ => _rows.Last().Add(Text.Empty)); Enumerable.Range(0, diff).ForEach(_ => _rows.Last().Add(Text.Empty));
} }
return this;
} }
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -1,5 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using Spectre.Console.Internal;
using Spectre.Console.Rendering;
namespace Spectre.Console namespace Spectre.Console
{ {
@@ -8,13 +10,58 @@ namespace Spectre.Console
/// </summary> /// </summary>
public static class TableExtensions public static class TableExtensions
{ {
/// <summary>
/// Adds multiple columns to the table.
/// </summary>
/// <param name="table">The table to add the column to.</param>
/// <param name="columns">The columns to add.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table AddColumns(this Table table, params TableColumn[] columns)
{
if (table is null)
{
throw new ArgumentNullException(nameof(table));
}
if (columns is null)
{
throw new ArgumentNullException(nameof(columns));
}
foreach (var column in columns)
{
table.AddColumn(column);
}
return table;
}
/// <summary>
/// Adds an empty row to the table.
/// </summary>
/// <param name="table">The table to add the row to.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table AddEmptyRow(this Table table)
{
if (table is null)
{
throw new ArgumentNullException(nameof(table));
}
var columns = new IRenderable[table.ColumnCount];
Enumerable.Range(0, table.ColumnCount).ForEach(index => columns[index] = Text.Empty);
table.AddRow(columns);
return table;
}
/// <summary> /// <summary>
/// Adds a column to the table. /// Adds a column to the table.
/// </summary> /// </summary>
/// <param name="table">The table to add the column to.</param> /// <param name="table">The table to add the column to.</param>
/// <param name="column">The column to add.</param> /// <param name="column">The column to add.</param>
/// <returns>The added <see cref="TableColumn"/> instance.</returns> /// <param name="configure">Delegate that can be used to configure the added column.</param>
public static TableColumn AddColumn(this Table table, string column) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table AddColumn(this Table table, string column, Action<TableColumn>? configure = null)
{ {
if (table is null) if (table is null)
{ {
@@ -27,9 +74,10 @@ namespace Spectre.Console
} }
var tableColumn = new TableColumn(column); var tableColumn = new TableColumn(column);
table.AddColumn(tableColumn); configure?.Invoke(tableColumn);
return tableColumn; table.AddColumn(tableColumn);
return table;
} }
/// <summary> /// <summary>
@@ -37,7 +85,8 @@ namespace Spectre.Console
/// </summary> /// </summary>
/// <param name="table">The table to add the columns to.</param> /// <param name="table">The table to add the columns to.</param>
/// <param name="columns">The columns to add.</param> /// <param name="columns">The columns to add.</param>
public static void AddColumns(this Table table, params string[] columns) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table AddColumns(this Table table, params string[] columns)
{ {
if (table is null) if (table is null)
{ {
@@ -53,6 +102,8 @@ namespace Spectre.Console
{ {
AddColumn(table, column); AddColumn(table, column);
} }
return table;
} }
/// <summary> /// <summary>
@@ -60,7 +111,8 @@ namespace Spectre.Console
/// </summary> /// </summary>
/// <param name="table">The table to add the row to.</param> /// <param name="table">The table to add the row to.</param>
/// <param name="columns">The row columns to add.</param> /// <param name="columns">The row columns to add.</param>
public static void AddRow(this Table table, params string[] columns) /// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table AddRow(this Table table, params string[] columns)
{ {
if (table is null) if (table is null)
{ {
@@ -73,6 +125,7 @@ namespace Spectre.Console
} }
table.AddRow(columns.Select(column => new Markup(column)).ToArray()); table.AddRow(columns.Select(column => new Markup(column)).ToArray());
return table;
} }
/// <summary> /// <summary>