功能特点
代码:
[Python] 纯文本查看 复制代码
import shutil
import os
from datetime import datetime
def setup_obsidian_tool_management():
# 定义路径
DESKTOP_PATH = os.path.expanduser("~/Desktop")
OBSIDIAN_TOOLS_PATH = "Obsidian仓库路径"
# 创建工具映射文件
for tool in os.listdir(DESKTOP_PATH):
if tool.endswith('.py'):
# 复制文件到 Obsidian
tool_path = os.path.join(DESKTOP_PATH, tool)
new_path = os.path.join(OBSIDIAN_TOOLS_PATH, tool)
shutil.copy2(tool_path, new_path)
# 创建对应的 markdown 文档
create_tool_doc(tool)
# 创建桌面快捷方式
create_shortcut(tool)
def create_tool_doc(tool_name):
template = f"""---
type: python-tool
name: {tool_name}
created: {datetime.now().strftime('%Y-%m-%d')}
last_used: {datetime.now().strftime('%Y-%m-%d')}
category: tool
status: active
---
# {tool_name} 工具说明
## 功能描述
[工具的主要功能]
## 使用方法
```python
# 示例代码