77# ## @Modified : Saturday,September 29 2018 15:21:16
88# ##-
99
10-
1110echo -e " \\ 033[0;32mDeploying updates to GitHub...\\ 033[0m"
1211export ROOT_PATH=" ${HOME} /Documents"
1312export GIT_LOCAL_PATH=" ${ROOT_PATH} /vscode-shell-snippets"
@@ -53,6 +52,12 @@ handle_exit_code() {
5352}
5453trap " handle_exit_code" EXIT
5554
55+ if [ $1 -eq " --setup" ]; then
56+ echo " [Setup Git]:"
57+ read $x ;
58+ fi
59+
60+
5661# todo: Setup git credential fill
5762# ## $(git credential fill \
5863# ## protocol=https \
@@ -82,30 +87,32 @@ if [ $# -eq 1 ]; then
8287 printf -- ' \033[32m [Git Commit]: [FINISHED] without errors. \033[0m\n'
8388fi
8489if [ $# -eq 2 ]; then
85- GIT_COMMIT_MSG=" [Git Commit]: at $( date --rfc-3339=seconds) "
90+ GIT_COMMIT_MSG=" [Git Commit]: at $( date --rfc-3339=seconds) "
8691 echo " [Git Comment]: ${GIT_COMMIT_MSG} "
8792 echo " [Git Commit]: at $( date --rfc-3339=seconds) "
8893 git commit -m " ${GIT_COMMIT_MSG} " || printf -- ' \033[31m [EXIT] with status code %s.\033[0m\n' ${ERROR_CODE:- 2} || exit 1
8994 printf -- ' \033[32m [Git Commit]: [FINISHED] without errors. \033[0m\n'
9095else
91- GIT_COMMIT_MSG=" [Git Commit]: at $( date --rfc-3339=seconds) "
92- echo " [Auto]: Setting GIT_COMMIT_MSG to ${GIT_COMMIT_MSG} "
96+ GIT_COMMIT_MSG=" [Git Commit]: at $( date --rfc-3339=seconds) "
97+ echo " [Auto]: Setting GIT_COMMIT_MSG to ${GIT_COMMIT_MSG} "
9398 printf -- ' \033[32m [Git Commit]: [FINISHED] without errors. \033[0m\n'
9499fi
95100
101+
96102if [ -d " ${GIT_LOCAL_PATH} " ]; then
97103 cd " ${GIT_LOCAL_PATH} " || echo " Current Dir: $PWD " || exit 2
98- printf -- ' \033[32m [SUCCESS]: %s \033[0m\n' " ${GIT_LOCAL_PATH} "
99-
100- # ## Setup for commit.
101- git add . || echo || exit 1
102- printf -- ' \033[32m [SUCCESS]: git add . \033[0m\n'
104+ printf -- ' \033[32m [SUCCESS]: %s \033[0m\n' " ${GIT_LOCAL_PATH} "
105+
106+ # ## Setup for commit.
107+ git add . || echo || exit 1
108+ printf -- ' \033[32m [SUCCESS]: git add . \033[0m\n'
103109
104- # ## Commit changes.
105- git commit -m " ${GIT_COMMIT_MSG} " || printf -- ' \033[31m [EXIT] with status code %s.\033[0m\n' ${ERROR_CODE:- 1} || exit 1
106- printf -- ' \033[32m [SUCCESS]: git commit -m \033[0m\n'
110+ # ## Commit changes.
111+ git commit -m " ${GIT_COMMIT_MSG} " || printf -- ' \033[31m [EXIT] with status code %s.\033[0m\n' ${ERROR_CODE:- 1} || exit 1
112+ printf -- ' \033[32m [SUCCESS]: git commit -m \033[0m\n'
107113
108- # ## Push code to Repository
109- git push origin master || printf -- ' \033[31m [EXIT] with status code %s.\033[0m\n' ${ERROR_CODE:- 1} || exit 1
110- printf -- ' \033[32m [SUCCESS]: git push origin master \033[0m\n'
111- fi
114+ # ## Push code to Repository
115+ git push origin master || printf -- ' \033[31m [EXIT] with status code %s.\033[0m\n' ${ERROR_CODE:- 1} || exit 1
116+ printf -- ' \033[32m [SUCCESS]: git push origin master \033[0m\n'
117+
118+ fi
0 commit comments