Rework CLI commands to be composable: pipe channels to export, remove exportguild/exportall/exportdm

Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/5f305835-64af-456e-b0b4-6163ece1e8cf

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-03 14:42:04 +00:00
committed by GitHub
parent 716ea79f60
commit efb371f093
7 changed files with 126 additions and 322 deletions

View File

@@ -30,20 +30,29 @@ public partial class GetDirectChannelsCommand : DiscordCommandBase
.OrderDescending()
.FirstOrDefault();
foreach (var channel in channels)
// If output is redirected, print only channel IDs (one per line) for easy piping
if (console.IsOutputRedirected)
{
// Channel ID
await console.Output.WriteAsync(
channel.Id.ToString().PadRight(channelIdMaxLength, ' ')
);
foreach (var channel in channels)
await console.Output.WriteLineAsync(channel.Id.ToString());
}
else
{
foreach (var channel in channels)
{
// Channel ID
await console.Output.WriteAsync(
channel.Id.ToString().PadRight(channelIdMaxLength, ' ')
);
// Separator
using (console.WithForegroundColor(ConsoleColor.DarkGray))
await console.Output.WriteAsync(" | ");
// Separator
using (console.WithForegroundColor(ConsoleColor.DarkGray))
await console.Output.WriteAsync(" | ");
// Channel name
using (console.WithForegroundColor(ConsoleColor.White))
await console.Output.WriteLineAsync(channel.GetHierarchicalName());
// Channel name
using (console.WithForegroundColor(ConsoleColor.White))
await console.Output.WriteLineAsync(channel.GetHierarchicalName());
}
}
}
}