-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevops.bat
More file actions
221 lines (167 loc) · 3.86 KB
/
devops.bat
File metadata and controls
221 lines (167 loc) · 3.86 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
@ECHO OFF &SETLOCAL
::echo %HOMEPATH%\path.txt
::setlocal enableextensions enabledelayedexpansion
::set devops_path=%cd%\devops
::for /f "delims=" %%i in (%HOMEPATH%\path.txt) do (
:: set devops_path=%%i
::)
::endlocal
:: Init
IF "%DEVOPSPATH%"=="" (
SET DEVOPSPATH=%cd%
setx path "%path%;%DEVOPSPATH%"
call doskey do=%DEVOPSPATH%"\devops.bat" $*
)
more %DEVOPSPATH%\doc\logo\soft.txt
echo DevOps Project Tool
echo.
:: set default path
:: change Color
:: COLOR [background][foreground]
::call color 02
::call color 0A
::call color 1F
call color 0A
:: LOGS
set log_file=%DEVOPSPATH%\log\command.txt
set log_time=%time% < nul
set log_content=do %1 %2 %3
echo %log_time% %log_content% >> %log_file%
:: Detect system
SET /a count=5
for %%a in (%*) do (
IF NOT %%a==google call set "qu=%%qu%%+%%a"
)
::ECHO %Myvar:~2%
:: Start script from dedicated system
:: Check PARAM
:: IF %1.==. GOTO No1
:: IF %2.==. GOTO No2
:: ... do stuff...
:: GOTO End1
:: setlocal enabledelayedexpansion
::set qu=
::for %%i in (%*) do (
:: set qu=%qu%+%%i
::)
::for %%I IN (%*) DO set qu=%qu% %%I
:: ECHO !qu!
set os=windows
::set "app="
set app=%2
::set "command="
set command=%1
set query=%3
set params=%3 %4 %5
set user_home_path=%USERPROFILE%
set user_path=%homepath%
set user_name=%homepath%
set os_partition=%systemdrive%
set os_path=%systemdrive%%homepath%
for /f "tokens=4-7 delims=[.] " %%i in ('ver') do (if %%i==Version (set v=%%j.%%k) else (set v=%%i.%%j))
IF %v%==10.0 set ver=10
::echo .\windows\%ver%\%app%\%command%.bat
:: One Param Command
IF %command%==home GOTO Home
IF %command%==who GOTO WhoIs
IF %app%=="" %command%=="" GOTO DevopsDocumentation
:: set app=devops
::
:: Multi Paramn Command
set app_path=%DEVOPSPATH%\windows\%ver%\%2
IF NOT EXIST %app_path% GOTO PathNotExist
set app_path_file=%app_path%\%1.bat
IF NOT EXIST %app_path_file% GOTO PathNotExist
echo.
IF %app%==doc call .\doc.bat
IF %app%==google GOTO API
IF %app%==demo GOTO Demo
IF %command%==create GOTO Create
IF %command%==install GOTO Install
IF %command%==remove GOTO Remove
IF %command%==on GOTO Source
IF %command%==doc GOTO Documentation
:: :No2
:: for %%i in (%*) do (
:: echo %%i
:: IF %%i==-i GOTO Info
:: IF %%i==-v GOTO Version
:: IF %%i==install GOTO Install
:: )
:: :Info
:: ECHO Info
:: GOTO End1
:: :Version
:: ECHO No param 2
:: .\os\version.bat
:: GOTO End1
:WhoIs
echo %USERNAME%
GOTO End1
:Home
cd %DEVOPSPATH%
GOTO End1
:Demo
.\windows\%ver%\%command%\%app%.bat
GOTO End1
:Source
::echo Source
::.\windows\%ver%\%command%\%app%.bat
set com=".\windows\%ver%\%2\%1.bat" $*
::echo %com%
call %com%
GOTO End1
:Create
::.\windows\%ver%\%command%\%app%.bat
set com=".\windows\%ver%\%app%\%command%.bat" $*
echo %com%
call %com%
GOTO End1
:Install
cls
call %app_path_file%
GOTO End1
:Remove
set com=%DEVOPSPATH%\windows\%ver%\%app%\%command%.bat
echo %com%
call %com%
GOTO End1
:DevopsDocumentation
::cls
IF %v%==10.0 set ver=10
set com=%DEVOPSPATH%"\windows\%ver%\devops\doc.bat"
::echo %com%
call %com%
GOTO End1
:Documentation
::cls
IF %v%==10.0 set ver=10
set com=".\windows\%ver%\%app%\%command%.bat" $*
echo %com%
call %com%
GOTO End1
:API
for /f "tokens=4-7 delims=[.] " %%i in ('ver') do (if %%i==Version (set v=%%j.%%k) else (set v=%%i.%%j))
:: https://stackoverflow.com/questions/203090/how-do-i-get-current-datetime-on-the-windows-command-line-in-a-suitable-format
set year=get-date -format "{yyyy}"
set com=.\api\public\%app%\%command%.bat year+%os%+%v%%qu%
echo %com%
call %com%
:: .\api\%app%\%command%.bat %os%+%v%%qu%
GOTO End1
:PathNotExist
echo " APth of APP not exist: "%app_path%
echo " APth of APP not exist: "%app_path_file%
GOTO End1
:: devops.bat api google how create+file+in+bash
:: -i
:: --info
:: -v
:: --version
:: ./os/detect.bat
:No1
ECHO No param 1
GOTO End1
:End1
echo.
echo END