Improve command-specific implementation #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
title: Improve Command-Specific Implementation (SRP in
CliandRunClasses)description: Strengthen adherence to the Single Responsibility Principle (SRP) by better separating argument parsing from command execution logic within command-specific
CliandRunclasses.current_situation:
DocMachine::Container::Cli.add_optionscontains a largeProc(Nil)block that handles a significant portion of execution logic, including subcommand dispatch and argument shifting.expected_outcome:
[CommandName]::Cliclasses primarily focus on definingOptionParseroptions and preparing a command-specific configuration.[CommandName]::Runclasses encapsulate the core execution logic, receiving a fully prepared configuration object.Proc(Nil)registered by[CommandName]::Clishould mainly instantiate and invoke the[CommandName]::Runclass.technical_details:
DocMachine::Container::Cli#add_optionsto push more logic intoDocMachine::Container::Runor dedicated helper methods.container pull) to be more modular, possibly by using nestedOptionParserinstances or a more abstract dispatch mechanism.0b5737f Improve command-specific implementationto Improve command-specific implementation