mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-29 09:18:05 +01:00
Add text prompt support
This commit is contained in:
committed by
Patrik Svensson
parent
380c6aca45
commit
0d209d8f18
@@ -18,6 +18,16 @@ namespace Spectre.Console
|
||||
return new Recorder(console);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the specified string value to the console.
|
||||
/// </summary>
|
||||
/// <param name="console">The console to write to.</param>
|
||||
/// <param name="text">The text to write.</param>
|
||||
public static void Write(this IAnsiConsole console, string text)
|
||||
{
|
||||
Write(console, text, Style.Plain);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the specified string value to the console.
|
||||
/// </summary>
|
||||
@@ -31,6 +41,11 @@ namespace Spectre.Console
|
||||
throw new ArgumentNullException(nameof(console));
|
||||
}
|
||||
|
||||
if (text is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(text));
|
||||
}
|
||||
|
||||
console.Write(new Segment(text, style));
|
||||
}
|
||||
|
||||
@@ -48,6 +63,16 @@ namespace Spectre.Console
|
||||
console.Write(Environment.NewLine, Style.Plain);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the specified string value, followed by the current line terminator, to the console.
|
||||
/// </summary>
|
||||
/// <param name="console">The console to write to.</param>
|
||||
/// <param name="text">The text to write.</param>
|
||||
public static void WriteLine(this IAnsiConsole console, string text)
|
||||
{
|
||||
WriteLine(console, text, Style.Plain);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the specified string value, followed by the current line terminator, to the console.
|
||||
/// </summary>
|
||||
@@ -61,6 +86,11 @@ namespace Spectre.Console
|
||||
throw new ArgumentNullException(nameof(console));
|
||||
}
|
||||
|
||||
if (text is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(text));
|
||||
}
|
||||
|
||||
console.Write(new Segment(text, style));
|
||||
console.WriteLine();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user