From c428ecc075e1275a78d0b6695fd5167633e1b2a7 Mon Sep 17 00:00:00 2001 From: czasg <972542655@qq.com> Date: Sat, 26 Oct 2024 10:30:27 +0800 Subject: [PATCH] feat: add init cmd --- entrypoint/__init__.py | 2 ++ entrypoint/init/__init__.py | 11 +++++++++++ entrypoint/init/project.py | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 entrypoint/init/__init__.py create mode 100644 entrypoint/init/project.py diff --git a/entrypoint/__init__.py b/entrypoint/__init__.py index 48c9025..2e12867 100644 --- a/entrypoint/__init__.py +++ b/entrypoint/__init__.py @@ -1,5 +1,6 @@ # coding: utf-8 import cc +import entrypoint.init import entrypoint.server @@ -21,6 +22,7 @@ def descriptions(self) -> str: def main(): cmd = PywssCommand() cmd.add( + entrypoint.init.InitCommand(), entrypoint.server.ServerCommand(), ) cc.Execute(cmd) diff --git a/entrypoint/init/__init__.py b/entrypoint/init/__init__.py new file mode 100644 index 0000000..b654b2f --- /dev/null +++ b/entrypoint/init/__init__.py @@ -0,0 +1,11 @@ +# coding: utf-8 +import cc + +from .project import ProjectCommand + + +class InitCommand(cc.Command): + + def __init__(self): + super().__init__() + self.add(ProjectCommand()) diff --git a/entrypoint/init/project.py b/entrypoint/init/project.py new file mode 100644 index 0000000..473592d --- /dev/null +++ b/entrypoint/init/project.py @@ -0,0 +1,11 @@ +# coding: utf-8 +import cc +import loggus + + +class ProjectCommand(cc.Command): + class flags: + name = cc.FlagStr(flags=["-n", "--name"], description="project name", require=True) + + def run(self, *args, **flags): + loggus.info(f"init project: {self.flags.name.value()}")