huhan3000/scripts/quick_merge_docs.sh

53 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 胡汉三千年项目文档快速归并脚本
echo "🚀 胡汉三千年项目文档归并工具"
echo "=================================="
# 设置项目根目录
PROJECT_ROOT="/home/ben/code/huhan3000"
TOOL_DIR="$PROJECT_ROOT/tools/doc-merger"
# 检查Python环境
if ! command -v python3 &> /dev/null; then
echo "❌ 错误: 未找到Python3请先安装Python3"
exit 1
fi
# 检查工具目录
if [ ! -d "$TOOL_DIR" ]; then
echo "📁 创建工具目录..."
mkdir -p "$TOOL_DIR"
fi
# 检查是否已安装必要依赖
echo "📦 检查依赖..."
python3 -c "import yaml" 2>/dev/null
if [ $? -ne 0 ]; then
echo "📦 安装PyYAML依赖..."
pip3 install pyyaml --quiet
if [ $? -ne 0 ]; then
echo "❌ 依赖安装失败,请手动安装: pip3 install pyyaml"
exit 1
fi
echo "✅ 依赖安装成功"
else
echo "✅ 依赖已安装"
fi
# 运行归并工具
echo ""
echo "🔧 开始文档归并..."
cd "$PROJECT_ROOT"
python3 "$TOOL_DIR/quick_merge.py"
if [ $? -eq 0 ]; then
echo ""
echo "🎉 文档归并完成!"
echo "📁 归并后的文档位于: $PROJECT_ROOT/core-docs/"
echo "📖 查看索引: cat $PROJECT_ROOT/core-docs/README.md"
else
echo "❌ 文档归并失败"
exit 1
fi