using System;
using System.Globalization;
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.
///
/// 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.
///
/// The console to write to.
/// The value to write.
public static void Markup(this IAnsiConsole console, string value)
{
console.Render(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.
///
/// 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);
}
}
}