Skip to content

Conversation

@AmirHkrg
Copy link

@AmirHkrg AmirHkrg commented Feb 3, 2025

Enhance Command Registration with registerCommandWithDependencies Method

Overview

This PR refactors the command registration process by introducing the registerCommandWithDependencies method. The goal is to improve readability, reduce boilerplate code, and make dependency injection for commands more maintainable.

Changes

  • Extracted commands that require dependencies into $registerCommandsWithDependencies.
  • Added registerCommandWithDependencies to handle automatic dependency resolution.
  • Kept other commands in $commands and $devCommands for clarity.
  • Improved maintainability by reducing repetitive registerXXXCommand methods.

Benefits

  • Less boilerplate code – Fewer explicit registration methods.
  • Better maintainability – Easier to add new commands by simply updating $registerCommandsWithDependencies.
  • Cleaner structure – Command dependencies are now explicitly defined in a single place.

Testing

  • Verified that all commands register correctly.
  • Ensured no breaking changes in the command execution flow.

Would love to get your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants