mirror of
https://github.com/snowykami/mbcp.git
synced 2026-04-28 13:25:38 +00:00
📝 litedoc新增类继承显示,新增变量自动获取注释,新增类方法和函数的区分,新增魔术方法的特殊展示模式
This commit is contained in:
46
litedoc/__main__.py
Normal file
46
litedoc/__main__.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
|
||||
@Time : 2024/8/28 下午4:08
|
||||
@Author : snowykami
|
||||
@Email : snowykami@outlook.com
|
||||
@File : __main__.py
|
||||
@Software: PyCharm
|
||||
"""
|
||||
# command line tool
|
||||
# args[0] path
|
||||
# -o|--output output path
|
||||
# -l|--lang zh-Hans en jp default zh-Hans
|
||||
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from litedoc.output import generate_from_module
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Generate documentation from Python modules.")
|
||||
parser.add_argument("path", type=str, help="Path to the Python module or package.")
|
||||
parser.add_argument("-o", "--output", default="doc-output", type=str, help="Output directory.")
|
||||
parser.add_argument("-c", "--contain-top", action="store_true", help="Whether to contain top-level dir in output dir.")
|
||||
parser.add_argument("-l", "--lang", nargs='+', default=["zh-Hans"], type=str, help="Languages of the document.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not os.path.exists(args.path):
|
||||
print(f"Error: The path {args.path} does not exist.")
|
||||
sys.exit(1)
|
||||
|
||||
if not os.path.exists(args.output):
|
||||
os.makedirs(args.output)
|
||||
|
||||
langs = args.lang
|
||||
for lang in langs:
|
||||
generate_from_module(args.path, args.output, with_top=args.contain_top, lang=lang)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user