Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] Command Pattern Implementation #6

Open
san-ghun opened this issue Nov 20, 2024 · 0 comments
Open

[refactor] Command Pattern Implementation #6

san-ghun opened this issue Nov 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@san-ghun
Copy link
Owner

The command handling in the main script could be refactored to use the Command pattern:

from abc import ABC, abstractmethod
from typing import List

class Command(ABC):
    @abstractmethod
    def execute(self, args: List[str]) -> None:
        pass

class RunCommand(Command):
    def execute(self, args: List[str]) -> None:
        run_tiny42_command(args)

class InitCommand(Command):
    def execute(self, args: List[str]) -> None:
        init_tiny42()

commands = {
    'run': RunCommand(),
    'init': InitCommand(),
    # Add other commands
}
@san-ghun san-ghun added the enhancement New feature or request label Nov 20, 2024
@san-ghun san-ghun changed the title [feat] Command Pattern Implementation [refactor] Command Pattern Implementation Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant