-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrun.bat
More file actions
116 lines (101 loc) · 2.87 KB
/
run.bat
File metadata and controls
116 lines (101 loc) · 2.87 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
115
116
@echo off
REM ==============================================================================
REM AUTO-blogger Run Script for Windows
REM Copyright (c) 2025 AryanVBW
REM ==============================================================================
setlocal EnableDelayedExpansion
set "VENV_DIR=venv"
set "SCRIPT_DIR=%~dp0"
REM Colors
set "RED=[91m"
set "GREEN=[92m"
set "YELLOW=[93m"
set "BLUE=[94m"
set "NC=[0m"
REM Default values
set "COMMAND=gui"
set "USE_VENV=true"
set "DEBUG=false"
REM Parse arguments
:parse_args
if "%~1"=="" goto :run
if /i "%~1"=="--no-venv" set "USE_VENV=false" & shift & goto :parse_args
if /i "%~1"=="--debug" set "DEBUG=true" & shift & goto :parse_args
if /i "%~1"=="--help" goto :show_help
if /i "%~1"=="-h" goto :show_help
if /i "%~1"=="gui" set "COMMAND=gui" & shift & goto :parse_args
if /i "%~1"=="cli" set "COMMAND=cli" & shift & goto :parse_args
if /i "%~1"=="test" set "COMMAND=test" & shift & goto :parse_args
if /i "%~1"=="shell" set "COMMAND=shell" & shift & goto :parse_args
echo %RED%[ERROR]%NC% Unknown option: %~1
goto :show_help
:run
cd /d "%SCRIPT_DIR%"
REM Activate virtual environment
if "%USE_VENV%"=="true" (
if exist "%VENV_DIR%\Scripts\activate.bat" (
call "%VENV_DIR%\Scripts\activate.bat"
) else (
echo %BLUE%[INFO]%NC% No virtual environment found. Using system Python.
)
)
REM Set debug mode
if "%DEBUG%"=="true" (
set "AUTO_BLOGGER_DEBUG=1"
set "PYTHONVERBOSE=1"
echo %BLUE%[INFO]%NC% Debug mode enabled
)
REM Execute command
if "%COMMAND%"=="gui" goto :run_gui
if "%COMMAND%"=="cli" goto :run_cli
if "%COMMAND%"=="test" goto :run_test
if "%COMMAND%"=="shell" goto :run_shell
:run_gui
echo %BLUE%[INFO]%NC% Starting AUTO-blogger GUI...
python -m auto_blogger.gui_blogger %*
goto :end
:run_cli
echo %BLUE%[INFO]%NC% Starting AUTO-blogger CLI...
where autoblog >nul 2>&1
if %errorlevel%==0 (
autoblog %*
) else (
python -m auto_blogger %*
)
goto :end
:run_test
echo %BLUE%[INFO]%NC% Running tests...
pytest tests/ -v %*
goto :end
:run_shell
echo %BLUE%[INFO]%NC% Starting Python shell...
python -c "from auto_blogger import *; print('AUTO-blogger loaded.')"
python -i -c "from auto_blogger import *"
goto :end
:show_help
echo.
echo AUTO-blogger Run Script
echo ========================
echo.
echo Usage: run.bat [OPTIONS] [COMMAND]
echo.
echo Commands:
echo gui Run the GUI application (default)
echo cli Run command-line interface
echo test Run tests
echo shell Start Python shell with package loaded
echo.
echo Options:
echo --no-venv Run without activating virtual environment
echo --debug Run with debug logging
echo --help Show this help message
echo.
echo Examples:
echo run.bat # Run GUI
echo run.bat gui # Run GUI
echo run.bat cli # Run CLI
echo run.bat --debug gui # Run GUI with debug
echo.
goto :end
:end
endlocal