Skip to content

Centralize collection dispatch to reduce duplication #119

@oritwoen

Description

@oritwoen

The collection name → module mapping is duplicated in 6+ places:

  • `lib.rs::get()` — universal puzzle lookup
  • `lib.rs::all()` — iterator over all puzzles
  • `cli.rs::cmd_list()` — list dispatcher
  • `cli.rs::cmd_search()` — search dispatcher
  • `cli.rs::cmd_author()` — author dispatcher
  • `cli.rs::cmd_export()` — export dispatcher (internally builds collection list)

Each one has its own match block with the same collection names. When a new collection is added (like arweave in #111), every location needs updating. Missing one causes silent bugs — #115 is an example where ballet was added to the module but not to CLI dispatchers.

A central registry (e.g. a `Collection` enum or a static dispatch table) that maps names to `all()`/`author()`/`get()` would let each new collection be registered once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions