mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-09-14 17:05:33 +08:00
Add JSON text renderer (#1086)
* Add JsonText widget to render highlighted JSON Closes #1051
This commit is contained in:
17
test/Spectre.Console.Tests/Extensions/StreamExtensions.cs
Normal file
17
test/Spectre.Console.Tests/Extensions/StreamExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Spectre.Console.Tests;
|
||||
|
||||
public static class StreamExtensions
|
||||
{
|
||||
public static string ReadText(this Stream stream)
|
||||
{
|
||||
if (stream is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(stream));
|
||||
}
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user