-
Notifications
You must be signed in to change notification settings - Fork 0
/
-project.bat
87 lines (87 loc) · 1.77 KB
/
-project.bat
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
@echo off
:: Variables
set CMD=%~1
set PARAM=%~2
set USER=%~3
set PROJECT=%~4
:: get Variable from File
IF EXIST "project\%CMD%.txt" (
set PROJECT_VAR = < project\%CMD%.txt
) ELSE (
:: echo "" > project\%CMD%.txt
:: set PROJECT_VAR = < project\%CMD%.txt
ECHO Variable file: 'project\%CMD%.txt' not found
)
::::::::::::::
:: Exist
if "%PARAM%"=="e" GOTO exist
if "%PARAM%"=="exist" GOTO exist
:: Name
if "%PARAM%"=="n" GOTO name
if "%PARAM%"=="name" GOTO name
:: Create
if "%PARAM%"=="c" GOTO create
if "%PARAM%"=="create" GOTO create
:: Delete
if "%PARAM%"=="d" GOTO delete
if "%PARAM%"=="delete" GOTO delete
::::::::::::::
:help
echo "Params: exist, name"
echo "Params & Variables: create, delete"
echo Example:
echo %CMD% exist
echo %CMD% name
echo %CMD% create "username" "projectname"
echo %CMD% delete "username" "projectname"
GOTO end
::::::::::::::
:exist
IF EXIST "project\%CMD%.txt" (
ECHO true
) ELSE (
ECHO false
)
GOTO end
::::::::::::::
:name
IF EXIST "project\%CMD%.txt" (
ECHO < project\%CMD%.txt
) ELSE (
:: ECHO false
)
GOTO end
::::::::::::::
:create
if "%USER%"=="" GOTO user_empty
if "%PROJECT%"=="" GOTO project_empty
..\%CMD%\-create.bat %USER% %PROJECT%
echo %PROJECT% is created
GOTO end
::::::::::::::
:delete
if "%USER%"=="" GOTO user_empty
if "%PROJECT%"=="" GOTO project_empty
..\%CMD%\-delete.bat %USER% %PROJECT%
echo %PROJECT% is deleted
GOTO end
::::::::::::::
:user_empty
echo second parameter "USER" is empty
GOTO create_example
::::::::::::::
:project_empty
echo third parameter "PROJECT" is empty
GOTO delete_example
::::::::::::::
:create_example
echo Create Example:
echo %CMD% create "username" "projectname"
GOTO end
::::::::::::::
:delete_example
echo Delete Example:
echo %CMD% delete "username" "projectname"
GOTO end
::::::::::::::
:end