using System; using Spectre.Console.Rendering; namespace Spectre.Console { /// /// Contains extension methods for . /// public static partial class AnsiConsoleExtensions { /// /// Creates a recorder for the specified console. /// /// The console to record. /// A recorder for the specified console. public static Recorder CreateRecorder(this IAnsiConsole console) { return new Recorder(console); } /// /// Writes the specified string value to the console. /// /// The console to write to. /// The text to write. public static void Write(this IAnsiConsole console, string text) { Write(console, text, Style.Plain); } /// /// Writes the specified string value to the console. /// /// The console to write to. /// The text to write. /// The text style. public static void Write(this IAnsiConsole console, string text, Style style) { if (console is null) { throw new ArgumentNullException(nameof(console)); } if (text is null) { throw new ArgumentNullException(nameof(text)); } console.Write(new Segment(text, style)); } /// /// Writes an empty line to the console. /// /// The console to write to. public static void WriteLine(this IAnsiConsole console) { if (console is null) { throw new ArgumentNullException(nameof(console)); } console.Write(Environment.NewLine, Style.Plain); } /// /// Writes the specified string value, followed by the current line terminator, to the console. /// /// The console to write to. /// The text to write. public static void WriteLine(this IAnsiConsole console, string text) { WriteLine(console, text, Style.Plain); } /// /// Writes the specified string value, followed by the current line terminator, to the console. /// /// The console to write to. /// The text to write. /// The text style. public static void WriteLine(this IAnsiConsole console, string text, Style style) { if (console is null) { throw new ArgumentNullException(nameof(console)); } if (text is null) { throw new ArgumentNullException(nameof(text)); } console.Write(new Segment(text, style)); console.WriteLine(); } } }