Improve command-specific implementation #11

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

title: Improve Command-Specific Implementation (SRP in Cli and Run Classes)
description: Strengthen adherence to the Single Responsibility Principle (SRP) by better separating argument parsing from command execution logic within command-specific Cli and Run classes.
current_situation: DocMachine::Container::Cli.add_options contains a large Proc(Nil) block that handles a significant portion of execution logic, including subcommand dispatch and argument shifting.
expected_outcome:

  • [CommandName]::Cli classes primarily focus on defining OptionParser options and preparing a command-specific configuration.
  • [CommandName]::Run classes encapsulate the core execution logic, receiving a fully prepared configuration object.
  • The Proc(Nil) registered by [CommandName]::Cli should mainly instantiate and invoke the [CommandName]::Run class.
    technical_details:
  • Refactor DocMachine::Container::Cli#add_options to push more logic into DocMachine::Container::Run or dedicated helper methods.
  • Potentially redefine how nested subcommands are handled (e.g., container pull) to be more modular, possibly by using nested OptionParser instances or a more abstract dispatch mechanism.

--- title: Improve Command-Specific Implementation (SRP in `Cli` and `Run` Classes) description: Strengthen adherence to the Single Responsibility Principle (SRP) by better separating argument parsing from command execution logic within command-specific `Cli` and `Run` classes. current_situation: `DocMachine::Container::Cli.add_options` contains a large `Proc(Nil)` block that handles a significant portion of execution logic, including subcommand dispatch and argument shifting. expected_outcome: - `[CommandName]::Cli` classes primarily focus on defining `OptionParser` options and preparing a command-specific configuration. - `[CommandName]::Run` classes encapsulate the core execution logic, receiving a fully prepared configuration object. - The `Proc(Nil)` registered by `[CommandName]::Cli` should mainly instantiate and invoke the `[CommandName]::Run` class. technical_details: - Refactor `DocMachine::Container::Cli#add_options` to push more logic into `DocMachine::Container::Run` or dedicated helper methods. - Potentially redefine how nested subcommands are handled (e.g., `container pull`) to be more modular, possibly by using nested `OptionParser` instances or a more abstract dispatch mechanism. ---
glenux changed title from 0b5737f Improve command-specific implementation to Improve command-specific implementation 2025-11-19 13:18:41 +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#11
No description provided.