namespace Spectre.Console;
///
/// Contains extension methods for .
///
public static partial class AnsiConsoleExtensions
{
///
/// Writes the specified markup to the console.
///
/// The console to write to.
/// A composite format string.
/// An array of objects to write.
public static void Markup(this IAnsiConsole console, string format, params object[] args)
{
Markup(console, CultureInfo.CurrentCulture, format, args);
}
///
/// Writes the specified markup to the console.
///
/// All interpolation holes which contain a string are automatically escaped so you must not call .
///
///
///
/// string input = args[0];
/// string output = Process(input);
/// console.MarkupInterpolated($"[blue]{input}[/] -> [green]{output}[/]");
///
///
/// The console to write to.
/// The interpolated string value to write.
public static void MarkupInterpolated(this IAnsiConsole console, FormattableString value)
{
MarkupInterpolated(console, CultureInfo.CurrentCulture, value);
}
///
/// Writes the specified markup to the console.
///
/// The console to write to.
/// An object that supplies culture-specific formatting information.
/// A composite format string.
/// An array of objects to write.
public static void Markup(this IAnsiConsole console, IFormatProvider provider, string format, params object[] args)
{
Markup(console, string.Format(provider, format, args));
}
///
/// Writes the specified markup to the console.
///
/// All interpolation holes which contain a string are automatically escaped so you must not call .
///
///
///
/// string input = args[0];
/// string output = Process(input);
/// console.MarkupInterpolated(CultureInfo.InvariantCulture, $"[blue]{input}[/] -> [green]{output}[/]");
///
///
/// The console to write to.
/// An object that supplies culture-specific formatting information.
/// The interpolated string value to write.
public static void MarkupInterpolated(this IAnsiConsole console, IFormatProvider provider, FormattableString value)
{
Markup(console, Console.Markup.EscapeInterpolated(provider, value));
}
///
/// Writes the specified markup to the console.
///
/// The console to write to.
/// The value to write.
public static void Markup(this IAnsiConsole console, string value)
{
console.Write(MarkupParser.Parse(value));
}
///
/// Writes the specified markup, followed by the current line terminator, to the console.
///
/// The console to write to.
/// A composite format string.
/// An array of objects to write.
public static void MarkupLine(this IAnsiConsole console, string format, params object[] args)
{
MarkupLine(console, CultureInfo.CurrentCulture, format, args);
}
///
/// Writes the specified markup, followed by the current line terminator, to the console.
///
/// All interpolation holes which contain a string are automatically escaped so you must not call .
///
///
///
/// string input = args[0];
/// string output = Process(input);
/// console.MarkupLineInterpolated($"[blue]{input}[/] -> [green]{output}[/]");
///
///
/// The console to write to.
/// The interpolated string value to write.
public static void MarkupLineInterpolated(this IAnsiConsole console, FormattableString value)
{
MarkupLineInterpolated(console, CultureInfo.CurrentCulture, value);
}
///
/// Writes the specified markup, followed by the current line terminator, to the console.
///
/// The console to write to.
/// The value to write.
public static void MarkupLine(this IAnsiConsole console, string value)
{
Markup(console, value + Environment.NewLine);
}
///
/// Writes the specified markup, followed by the current line terminator, to the console.
///
/// The console to write to.
/// An object that supplies culture-specific formatting information.
/// A composite format string.
/// An array of objects to write.
public static void MarkupLine(this IAnsiConsole console, IFormatProvider provider, string format, params object[] args)
{
Markup(console, provider, format + Environment.NewLine, args);
}
///
/// Writes the specified markup, followed by the current line terminator, to the console.
///
/// All interpolation holes which contain a string are automatically escaped so you must not call .
///
///
///
/// string input = args[0];
/// string output = Process(input);
/// console.MarkupLineInterpolated(CultureInfo.InvariantCulture, $"[blue]{input}[/] -> [green]{output}[/]");
///
///
/// The console to write to.
/// An object that supplies culture-specific formatting information.
/// The interpolated string value to write.
public static void MarkupLineInterpolated(this IAnsiConsole console, IFormatProvider provider, FormattableString value)
{
MarkupLine(console, Console.Markup.EscapeInterpolated(provider, value));
}
}