Repository navigation
Expand file tree
/
Copy pathfast_view.bat
More file actions
114 lines (100 loc) · 2.9 KB
/
Copy pathfast_view.bat
File metadata and controls
114 lines (100 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
@REM mdbook fast view script with environment checks
@echo off
setlocal enabledelayedexpansion
echo ========================================
echo mdbook Fast View Script
echo ========================================
echo.
REM 1. Environment Check - Python Version Validation
echo [1/4] Checking Python environment...
python --version >nul 2>&1
if !errorlevel! neq 0 (
echo [ERROR] Python is not installed or not in PATH environment variable
echo.
echo Please install Python 3.7+ and ensure it is added to PATH
echo Download: https://www.python.org/downloads/
echo.
pause
exit /b 1
)
REM Get Python version information
for /f "tokens=2" %%i in ('python --version 2^>^&1') do set PYTHON_VERSION=%%i
echo Python version: !PYTHON_VERSION!
REM Check if Python version is 3.7+
for /f "tokens=1,2 delims=." %%a in ("!PYTHON_VERSION!") do (
set MAJOR=%%a
set MINOR=%%b
)
if !MAJOR! lss 3 (
echo [ERROR] Python version too low, requires 3.7+
echo Current version: !PYTHON_VERSION!
echo.
pause
exit /b 1
)
if !MAJOR! equ 3 if !MINOR! lss 7 (
echo [ERROR] Python version too low, requires 3.7+
echo Current version: !PYTHON_VERSION!
echo.
pause
exit /b 1
)
echo [OK] Python environment check passed
echo.
echo [2/4] Checking dependency files...
REM 2. Dependency Validation - Check generate_summary.py
if not exist ".\tools\generate_summary.py" (
echo [ERROR] File not found: .\tools\generate_summary.py
echo Please confirm the file exists and path is correct
echo.
pause
exit /b 1
)
echo [OK] generate_summary.py file exists
REM Check mdbook.exe
if not exist ".\tools\mdbook.exe" (
echo [ERROR] File not found: .\tools\mdbook.exe
echo Please confirm mdbook.exe exists in tools directory
echo.
pause
exit /b 1
)
echo [OK] mdbook.exe file exists
echo.
echo [3/4] Generating SUMMARY.md file...
REM 3. Automated Execution Flow - Generate SUMMARY.md
python .\tools\generate_summary.py
if !errorlevel! neq 0 (
echo [ERROR] SUMMARY.md generation failed
echo Please check if generate_summary.py script works properly
echo.
pause
exit /b 1
)
REM Verify SUMMARY.md was successfully generated
if not exist "SUMMARY.md" (
echo [ERROR] SUMMARY.md file was not generated
echo Please check generate_summary.py script output
echo.
pause
exit /b 1
)
echo [OK] SUMMARY.md generated successfully
echo.
echo [4/4] Starting mdbook service...
REM 4. Start mdbook service
echo Starting mdbook server...
echo Server will automatically open in browser
echo Press Ctrl+C to stop server
echo.
.\tools\mdbook.exe serve --open
if !errorlevel! neq 0 (
echo [ERROR] mdbook service startup failed
echo Please check if mdbook.exe works properly
echo.
pause
exit /b 1
)
echo.
echo mdbook service stopped
pause