From 58b36b64e4674df312c42b479bf67925d71d9fba Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Mon, 18 Mar 2024 18:55:10 +0800 Subject: feat(project): add readme reading and initializing --- src/ipm/project/toml_file.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ipm/project/toml_file.py b/src/ipm/project/toml_file.py index c855408..6d9ed2a 100644 --- a/src/ipm/project/toml_file.py +++ b/src/ipm/project/toml_file.py @@ -30,6 +30,7 @@ def init_infini( author.multiline(True) project.add("authors", author) project.add("license", license) + project.add("readme", "README.md") toml_data.add("project", project) toml_data.add("requirements", tomlkit.table()) toml_data.add("dependencies", tomlkit.table()) @@ -53,7 +54,9 @@ def init_infini( "# Initialized `events.py` generated by ipm.\n" "# Regists your text events and regist global variables here.\n" "# Documents at https://docs.hydroroll.team/ipm\n\n" - "from infini.register import Register\n\n\n" + "from .events import register as events_register\n\n\n" + "from .handlers import register as handlers_register\n\n\n" + "from .interceptors import register as interceptors_register\n\n\n" "register = Register()\n" ) if not events_filepath.exists(): @@ -90,6 +93,10 @@ def init_infini( "register = Register()\n" ) + readme_filepath = target_path.joinpath("README.md") + if not readme_filepath.exists(): + readme_filepath.write_text(f"# {name.upper()} 规则包文档", encoding="utf-8") + def add_yggdrasil(toml_path: Path, name: str, index: str): project = InfiniProject(toml_path.parent) -- cgit v1.2.3-70-g09d2