Refactor CLI Dispatcher #9

Open
opened 2025-11-19 13:13:57 +00:00 by glenux · 0 comments
Owner

Description

The current src/cli.cr dispatcher is tightly coupled to specific subcommand modules. This task involves refactoring it to allow new top-level commands to be added without modifying the central dispatcher.

Expected outcome

New top-level commands can be registered with the central CLI dispatcher without touching src/cli.cr. DocMachine::Cli#start adheres to the Open/Closed Principle.

Current state

src/cli.cr directly imports and calls add_options on each subcommand module. Adding a new command requires editing src/cli.cr.

Technical details

  • Explore command discovery or registration patterns (array of CLI classes, macro-based registration, etc.).
  • The main CLI should iterate over registered command handlers.
  • Existing add_options signatures should be maintained or migrated cleanly.

Additional info

Local task id: a004f58.

## Description The current `src/cli.cr` dispatcher is tightly coupled to specific subcommand modules. This task involves refactoring it to allow new top-level commands to be added without modifying the central dispatcher. ## Expected outcome New top-level commands can be registered with the central CLI dispatcher without touching `src/cli.cr`. `DocMachine::Cli#start` adheres to the Open/Closed Principle. ## Current state `src/cli.cr` directly imports and calls `add_options` on each subcommand module. Adding a new command requires editing `src/cli.cr`. ## Technical details - Explore command discovery or registration patterns (array of CLI classes, macro-based registration, etc.). - The main CLI should iterate over registered command handlers. - Existing `add_options` signatures should be maintained or migrated cleanly. ## Additional info Local task id: a004f58.
glenux changed title from a004f58 Refactor CLI Dispatcher to Refactor CLI Dispatcher 2025-11-19 13:18:25 +00:00
glenux added this to the By Status project 2025-11-19 18:02:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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: glenux/docmachine-cli#9
No description provided.