From 47ebda69daa34ea7992b6bbadf46de98dd17a390 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 11 Nov 2024 01:12:29 +0800 Subject: HALF WORK: 2024.1.9 --- tools/cru-py/cru/service/_app.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/cru-py/cru/service/_app.py (limited to 'tools/cru-py/cru/service/_app.py') diff --git a/tools/cru-py/cru/service/_app.py b/tools/cru-py/cru/service/_app.py new file mode 100644 index 0000000..a656e3b --- /dev/null +++ b/tools/cru-py/cru/service/_app.py @@ -0,0 +1,24 @@ +from ._base import AppBase, CommandDispatcher, AppInitializer, OWNER_NAME +from ._config import ConfigManager +from ._data import DataManager +from ._template import TemplateManager + + +class App(AppBase): + def __init__(self): + super().__init__(f"{OWNER_NAME}-service") + self.add_feature(AppInitializer()) + self.add_feature(DataManager()) + self.add_feature(ConfigManager()) + self.add_feature(TemplateManager()) + self.add_feature(CommandDispatcher()) + + def run_command(self): + command_dispatcher = self.get_feature(CommandDispatcher) + command_dispatcher.run_command() + + +def create_app() -> App: + app = App() + app.setup() + return app -- cgit v1.2.3