Skip to content

Rework the CLI commands to be more composable #1210

Description

@Tyrrrz

Currently, we have commands like exportguild, exportall, exportdm which allow the user to export batches of channels. There are some filtering options available in those commands (such as --include-vc, --include-threads, etc), but they are not very composable.

If the user wants to have full control over which channels they want to export, the recommended approach is to use the channels command to fetch all channels (with some filtering available too), and then manually plug the IDs into the export command.

We can streamline this flow by making the channels command more configurable in terms of filters and, most importantly, making its output pipe-able into export. The idea is that the export command will not have any filtering options whatsoever (and exportguild, exportall, exportdm will be completely removed), but instead the user can pipe the result of channels directly.

For example:

$ ./DiscordChatExporter.Cli channels --guild 123456 --token 123456 --include-threads --include-dm | ./DiscordChatExporter.Cli export --token 123456

(to avoid repeating the --token twice, you can set it as an environment variable)

The channels command can detect if its output is being redirected and change the format to only produce channel IDs, separated by newlines. If the output is not redirected, then the current, info-rich and user-friendly format is used. We can also add command options to control this behavior explicitly.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions