refactor: Redesign CLI #1

Open
opened 2023-12-19 09:42:51 +00:00 by moanos · 0 comments
Owner

The CLI interface is currently not designed well. As this project is not (yet) widely used it is a good idea to redesign the CLI now. This issue tracks possible options and progress of implementing these.

The base command will be abbreviate to fbt = fediverse-blocklist-tool

Proposed solution

No flag solution. While previously servers or files were identified by flag, this is not strictly necessary. If files/servers are given as arguments without the user specifying a type we can use the file extension to assume the user means a local file as non of our supported formats (toml,markdown,csv,json) is a valid TDL 1.

The order of arguments can specify which list will be input, output etc..

  • fbt diff local_blocklist.toml other_local_blocklist.json: Works in any argument order
  • fbt diff ACCESS_TOKEN@fediserver1.org local_blocklist.toml: Mixing local and remote blocklists is not a problem
  • fbt export ACCESS_TOKEN@fediserver1.org blocklist_backup.toml: Exporting works by first specifying the remote instance, then the local file. This is the only valid combintation (or should we allow to convert a file to a different format via this?)
  • fbt deploy my_manual_blocklis.toml ACCESS_TOKEN@fediserver1.org: Deploy must specify the source as first argument and the target as second argument. There is no reason why the first argument couldn't be a server but the second MUST be a server

The ACCESS_TOKEN@fediserver.org syntax assumes there isn't an @ in either strings. If this is a problem we can work around this with using environment variables for the access token and implementing something like --literal for the domain (if ever necessary)

The CLI interface is currently not designed well. As this project is not (yet) widely used it is a good idea to redesign the CLI now. This issue tracks possible options and progress of implementing these. The base command will be abbreviate to `fbt` = `fediverse-blocklist-tool` # Proposed solution No flag solution. While previously servers or files were identified by flag, this is not strictly necessary. If files/servers are given as arguments without the user specifying a type we can use the file extension to assume the user means a local file as non of our supported formats (toml,markdown,csv,json) is a valid TDL [1](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains). The order of arguments can specify which list will be input, output etc.. * `fbt diff local_blocklist.toml other_local_blocklist.json`: Works in any argument order * `fbt diff ACCESS_TOKEN@fediserver1.org local_blocklist.toml`: Mixing local and remote blocklists is not a problem * `fbt export ACCESS_TOKEN@fediserver1.org blocklist_backup.toml`: Exporting works by first specifying the remote instance, then the local file. This is the only valid combintation (or should we allow to convert a file to a different format via this?) * `fbt deploy my_manual_blocklis.toml ACCESS_TOKEN@fediserver1.org`: Deploy must specify the source as first argument and the target as second argument. There is no reason why the first argument couldn't be a server but the second MUST be a server The `ACCESS_TOKEN@fediserver.org` syntax assumes there isn't an `@` in either strings. If this is a problem we can work around this with using environment variables for the access token and implementing something like `--literal` for the domain (if ever necessary)
moanos added this to the Version 1.0 project 2023-12-19 10:35:07 +00:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: moanos/fediverse-blocklist-tool#1
No description provided.