refactor: restructure project to modern Python layout, separate src, tests, docs, examples

This commit is contained in:
2025-08-07 16:57:41 +08:00
commit 4cb6c4eab7
27 changed files with 2580 additions and 0 deletions

49
examples/basic_usage.py Normal file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env python3
"""
Config-Man 基本使用示例
演示如何使用 Config-Man CLI 工具的基本功能。
"""
import sys
import os
# 添加项目根目录到路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from config_man.core import ViewCommand
from config_man.utils import patch_rclone
def main():
"""基本使用示例"""
print("Config-Man 基本使用示例")
print("=" * 50)
# 启用模拟环境
patch_rclone()
# 创建查看命令处理器
view_cmd = ViewCommand()
# 查看版本 0.30 的配置
print("\n1. 查看版本 0.30 的配置:")
success = view_cmd.execute("0.30", json_format=False)
if success:
print("✅ 查看成功")
else:
print("❌ 查看失败")
# 查看版本 0.29 的配置JSON格式
print("\n2. 查看版本 0.29 的配置JSON格式:")
success = view_cmd.execute("0.29", json_format=True)
if success:
print("✅ 查看成功")
else:
print("❌ 查看失败")
if __name__ == "__main__":
main()