-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.bat
More file actions
149 lines (140 loc) Β· 3.75 KB
/
config.bat
File metadata and controls
149 lines (140 loc) Β· 3.75 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@ECHO OFF
REM config.bat v1.1 @ 2025-02-14 - nelbren@nelbren.com
CHCP 65001 > NUL
<NUL set /p ="config.yml........"
IF EXIST "config.yml" (
call :color 2
ECHO β
call :color
) ELSE (
call :color 6
ECHO β
call :color
ECHO.
call :color 70
<NUL set /p ="copy config.yml.example config.yml"
call :color
ECHO.
copy config.yml.example config.yml
ECHO.
<NUL set /p ="config.yml........"
IF EXIST "config.yml" (
call :color 2
ECHO β
call :color
) ELSE (
call :color 4
ECHO Γ
call :color
ECHO.
call :color 6
ECHO Please manually copy config! ^( copy config.yml.example config.yml ^)
call :color
EXIT /B 5
)
)
<NUL set /p ="INSTRUCTURE_URL..."
type config.yml | findstr replace-with-your-INFRASTRUCTURE-URL_and_rename_this_file 1>/nul 2>/nul
IF %ERRORLEVEL% == 0 (
call :color 4
ECHO Γ
call :color
ECHO.
ECHO Change INSTRUCTURE_URL in config.yml!
EXIT /B 6
) ELSE (
call :color 2
ECHO β
call :color
)
<NUL set /p ="API_KEY..........."
type config.yml | findstr replace-with-your-KEY_API_and_rename_this_file 1>/nul 2>/nul
IF %ERRORLEVEL% == 0 (
call :color 4
ECHO Γ
call :color
ECHO.
call :color 6
ECHO Change APY_KEY in config.yml!
call :color
EXIT /B 7
) ELSE (
call :color 2
ECHO β
call :color
)
<NUL set /p ="COURSE_ID........."
type config.yml | findstr replace-with-your-COURSE_ID_and_rename_this_file 1>/nul 2>/nul
IF %ERRORLEVEL% == 0 (
call :color 4
ECHO Γ
call :color
ECHO.
call :color 6
ECHO Change COURSE_ID in config.yml!
call :color
EXIT /B 7
) ELSE (
call :color 2
ECHO β
call :color
)
goto :eof
REM https://stackoverflow.com/questions/2048509/how-to-echo-with-different-colors-in-the-windows-command-line
:: Displays a text without new line at the end (unlike echo)
:echo
@<nul set /p ="%*"
@goto :eof
:: Change color to the first parameter (same codes as for the color command)
:: And display the other parameters (write $ at the end for new line)
:color
@echo off
IF [%ESC%] == [] for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
SET color=0%1
IF [%color%] == [0] SET color=07
SET fore=%color:~-1%
SET back=%color:~-2,1%
SET color=%ESC%[
if %fore% LEQ 7 (
if %fore% == 0 SET color=%ESC%[30
if %fore% == 1 SET color=%ESC%[34
if %fore% == 2 SET color=%ESC%[32
if %fore% == 3 SET color=%ESC%[36
if %fore% == 4 SET color=%ESC%[31
if %fore% == 5 SET color=%ESC%[35
if %fore% == 6 SET color=%ESC%[33
if %fore% == 7 SET color=%ESC%[37
) ELSE (
if %fore% == 8 SET color=%ESC%[90
if %fore% == 9 SET color=%ESC%[94
if /i %fore% == a SET color=%ESC%[92
if /i %fore% == b SET color=%ESC%[96
if /i %fore% == c SET color=%ESC%[91
if /i %fore% == d SET color=%ESC%[95
if /i %fore% == e SET color=%ESC%[93
if /i %fore% == f SET color=%ESC%[97
)
if %back% == 0 (SET color=%color%;40) ELSE (
if %back% == 1 SET color=%color%;44
if %back% == 2 SET color=%color%;42
if %back% == 3 SET color=%color%;46
if %back% == 4 SET color=%color%;41
if %back% == 5 SET color=%color%;45
if %back% == 6 SET color=%color%;43
if %back% == 7 SET color=%color%;47
if %back% == 8 SET color=%color%;100
if %back% == 9 SET color=%color%;104
if /i %back% == a SET color=%color%;102
if /i %back% == b SET color=%color%;106
if /i %back% == c SET color=%color%;101
if /i %back% == d SET color=%color%;105
if /i %back% == e SET color=%color%;103
if /i %back% == f SET color=%color%;107
)
SET color=%color%m
:repeatcolor
if [%2] NEQ [$] SET color=%color%%~2
shift
if [%2] NEQ [] if [%2] NEQ [$] SET color=%color% & goto :repeatcolor
if [%2] EQU [$] (echo %color%) else (<nul set /p ="%color%")
goto :eof