-
Notifications
You must be signed in to change notification settings - Fork 0
/
Push_current_config.bat
54 lines (39 loc) · 1.69 KB
/
Push_current_config.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
@echo off
set repoauthor=YOUR GITHUB USERNAME
set reponame=YOUR GITHUB REPOSITORY NAME
:: Check if repoauthor has been set
IF NOT "%repoauthor%"=="%repoauthor:YOUR GITHUB USERNAME=%" (
goto:repoauthormissing
)
set remotesource=https://github.com/%repoauthor%/%reponame%.git
:: Check if git is installed
git version >nul 2>&1 || goto :giterror
cd %appdata%\PrusaSlicer || goto :othererror
IF NOT EXIST ".gitignore" (
echo .gitignore not found, creating one...
:: create .gitignore file with some default entries
echo *.bak >> .gitignore
echo /snapshots >> .gitignore
echo PrusaSlicerGcodeViewer* >> .gitignore
)
IF NOT EXIST ".git" (
echo .git folder not found, initializing repository...
git init || goto :othererror
git remote add origin %remotesource% || goto :othererror
)
git add .
git commit -m "Update config with batch shortcut"
git push -u origin main
ECHO: & ECHO -------------- & ECHO: & ECHO Done! & ECHO: & ECHO -------------- & ECHO: & PAUSE
exit /b 0
:giterror
:: Throw error if git is not installed
ECHO: & ECHO -------------- & ECHO: & ECHO You need to install git first! & ECHO: & ECHO You can download it here: https://git-scm.com/download/win & ECHO -------------- & ECHO: & PAUSE
exit /b 0
:othererror
:: Throw error if something else went wrong
ECHO: & ECHO -------------- & ECHO: & ECHO Something went wrong! See error above. & ECHO: & ECHO -------------- & ECHO: & PAUSE
exit /b 0
:repoauthormissing
:: Throw error if repoauthor has not been set
ECHO: & ECHO -------------- & ECHO: & ECHO You forgot to set your GitHub username in the script. & ECHO Please change the author and repository names and try again. & ECHO: & ECHO -------------- & ECHO: & PAUSE