aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2024-03-18 18:55:10 +0800
committer苏向夜 <fu050409@163.com>2024-03-18 18:55:10 +0800
commit58b36b64e4674df312c42b479bf67925d71d9fba (patch)
tree594f3fa3cf8669a04a3a4de1320d397a2f194712 /src
parent982a81f36672da2d5b6cbe8768a360aa1246bb1c (diff)
downloadipm-58b36b64e4674df312c42b479bf67925d71d9fba.tar.gz
ipm-58b36b64e4674df312c42b479bf67925d71d9fba.zip
feat(project): add readme reading and initializing
Diffstat (limited to 'src')
-rw-r--r--src/ipm/project/toml_file.py9
1 files changed, 8 insertions, 1 deletions
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)