mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-05-11 14:53:48 +00:00
Simplify stdin reading: use ReadAllLinesAsync extension and Snowflake.Parse
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/59c1113d-3c9c-4900-a9b0-5c6116ce7c75 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1087173fef
commit
316e8c6ea8
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using CliFx.Infrastructure;
|
||||
using Spectre.Console;
|
||||
@@ -61,4 +63,15 @@ internal static class ConsoleExtensions
|
||||
progressTask.StopTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader)
|
||||
{
|
||||
string? line;
|
||||
while ((line = await reader.ReadLineAsync()) is not null)
|
||||
{
|
||||
line = line.Trim();
|
||||
if (!string.IsNullOrEmpty(line))
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user