refactor: 重构项目结构并更新依赖配置
- 移除原有的 docx_thesis 模块及其相关文件 (cli.py, config.py, converter.py) - 新增 .claudeignore 文件以忽略 Python 生成文件和缓存 - 更新 .gitignore 文件添加更多忽略规则包括 .mypy_cache/, .ruff_cache/, .claude/, *.md 等 - 添加 README.md 使用说明文档 - 修改 pyproject.toml 依赖配置,新增 docxtpl、pyyaml, 移除原 thesis 命令入口点并更新为 transit.__main__ - 新增 transit 模块及相应初始化文件 - 重命名 main.py 为快速入口脚本
This commit is contained in:
34
transit/__main__.py
Normal file
34
transit/__main__.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""CLI 入口:python -m transit"""
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from .renderer import generate_thesis
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="毕业论文 Markdown → Word 格式转换工具"
|
||||
)
|
||||
parser.add_argument("data", type=str, help="Markdown 正文文件路径(.md)")
|
||||
parser.add_argument(
|
||||
"-t", "--template", default="sample.docx", help="docx 模板文件路径(默认: sample.docx)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--output", default="output.docx", help="输出 Word 文件路径(默认: output.docx)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c", "--config", default=None, help="TOML 配置文件路径(可选)"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
generate_thesis(
|
||||
template_path=args.template,
|
||||
data_path=args.data,
|
||||
config_path=args.config,
|
||||
output_path=args.output,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user