Rework CLI commands to be composable via piping#1522
Conversation
… 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>
…ne in channels redirect block Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/5f305835-64af-456e-b0b4-6163ece1e8cf Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/5f305835-64af-456e-b0b4-6163ece1e8cf Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
|
Let's employ the following command structure:
Keep the option binding for |
…l parameters Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/27f23ff6-5b39-46d3-a7dc-387749ee63fa Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Done in commit
./DiscordChatExporter.Cli list channels 123456 789012 | ./DiscordChatExporter.Cli exportWarning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot add a stub |
|
@copilot in the docs, show an example of the pipeline that starts by setting the environment variable for the token. Linux/macOS can be one-liners. |
|
@copilot |
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/b148b0cc-7ec8-4fa1-bbd6-36dfd116ceec Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Done in commit The top-level Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…TOKEN pipeline examples Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/98d87128-db13-4085-84c3-6290d3faffca Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Done in commit Linux/macOS: DISCORD_TOKEN="mfa.Ifrn" ./DiscordChatExporter.Cli list channels 21814 | ./DiscordChatExporter.Cli exportWindows: set DISCORD_TOKEN=mfa.Ifrn
DiscordChatExporter.Cli list channels 21814 | DiscordChatExporter.Cli export
Done in commit
Both are included in the |
|
For the ListCommand, error out with "Use of the nammed commands listed below". Update CLI docs to use the new |
…ce guard Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/e94c999b-5241-4e2e-9af1-01f6be95e72c Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…flakeJsonConverter in CLI Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/58698f45-e22e-4bd4-aec4-31f801051467 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/aa0b1344-6eb9-4853-9b48-afd06e94c970 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
| Name = "channel-ids", | ||
| Description = "Channel ID(s). " | ||
| + "If provided with category ID(s), all channels inside those categories will be exported." | ||
| + "If provided with category ID(s), all channels inside those categories will be exported. " |
There was a problem hiding this comment.
Safe to remove this, since we have list unwrap? Along with any code responsible for this @copilot
There was a problem hiding this comment.
Done in commit f8ab926. Removed the category description and unwrapping code from export — the command now simply resolves each channel ID and exports it. Added a new list unwrap command that reads a JSON channel array from stdin (produced by list channels / list channels dm) and replaces any category channels with their children:
./dce list channels 21814 | ./dce list unwrap | ./dce export
.docs/Using-the-CLI.md
Outdated
| ./dce list channels dm -t "mfa.Ifrn" | ||
| ``` | ||
|
|
||
| When the output is redirected or piped, the `list channels dm` command prints only channel IDs (one per line). This allows you to pipe the output directly to the `export` command: |
There was a problem hiding this comment.
Already addressed in commit f8ab926 — the outdated "prints only channel IDs (one per line)" text was updated to "outputs a JSON array of channel objects" for both list channels and list channels dm sections.
| [CommandOption("guild", 'g', Description = "Server ID.")] | ||
| public required Snowflake GuildId { get; set; } | ||
| [CommandParameter(0, Name = "server-ids", Description = "Server ID(s).")] | ||
| public required IReadOnlyList<Snowflake> GuildIds { get; set; } |
There was a problem hiding this comment.
Done in commit f6e7109. Renamed GuildIds to ServerIds and the loop variable from guildId to serverId throughout GetChannelsCommand.
…d [!IMPORTANT] callouts to pipeline doc sections Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/d2a03a38-0ed4-45c7-b8e7-615ffb35c971 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/d2a03a38-0ed4-45c7-b8e7-615ffb35c971 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…rverIds in GetChannelsCommand Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/ab01ba49-ad07-42ba-b382-27f4d105a92b Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
|
|
||
| [Command( | ||
| "list unwrap", | ||
| Description = "Resolves categories in a channel list to their child channels." |
There was a problem hiding this comment.
We should also resolve forum channels I think... @copilot
There was a problem hiding this comment.
Done in commit ea0b47f. list unwrap now also expands forum channels (GuildForum) to their thread posts using Discord.GetChannelThreadsAsync. Updated the command description and docs to mention forums alongside categories.
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/674ba90d-1778-4427-b50a-30bc50195319 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
listcommand that errors with help text when executedListCommanderror message to "Use one of the named commands listed below."dce(renamed fromdce.sh) pass-through script to CLI projectdce.batpass-through script to CLI projectdce/dce.batin the.csprojfor copy to output/publish directories./dce(Linux/macOS) anddce(Windows) aliasReadLinesAsync()extension onTextReaderinConsoleExtensions.csExportChannelsCommandto useReadLinesAsync()andSnowflake.Parse(line.Trim())list guilds→list servers; updateguild-idspositional parameter toserver-ids; replace all user-facing "guild(s)" references with "server(s)"DISCORD_TOKENenv var setup once near the topSnowflakeJsonConverterandCliJsonSerializerContextlist channels,list channels dm, andlist serversalways output a compact JSON arrayexportstdin reading accepts a JSON array or plain Snowflake IDs; detection now uses numeric check-short|--longconvention for option nameslist unwrapcommand; remove category unwrapping fromexport;list unwrapexpands both category channels to their children and forum channels to their thread posts[!IMPORTANT]callouts to pipeline sectionsexportstdin JSON detection to use!char.IsAsciiDigit(trimmed[0])instead ofStartsWith('[')GuildIdstoServerIdsinGetChannelsCommand