-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: The-Repo-Club <[email protected]>
- Loading branch information
1 parent
0f525cf
commit df3a048
Showing
1 changed file
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# GitHub - https://github.com/The-Repo-Club/ | ||
# Author - The-Repo-Club [[email protected]] | ||
# Start On - Fri 18 February 2022, 07:26:28 pm (GMT) | ||
# Modified On - Sun 20 February 2022, 01:13:49 pm (GMT) | ||
# Modified On - Mon 21 February 2022, 04:13:30 pm (GMT) | ||
# ------------------------------------------------------------------------- | ||
# | ||
# | ||
|
@@ -130,6 +130,44 @@ make_new_config() { | |
#============================================================================== | ||
} | ||
|
||
#=== FUNCTION ================================================================= | ||
# Name: initialize_repo | ||
# Description: initialize a git repo | ||
#============================================================================== | ||
|
||
initialize_repo() { | ||
depend 'git' | ||
isGit=$(git -C . rev-parse 2>/dev/null; echo $?) | ||
if [[ "$isGit" -eq "0" ]]; then | ||
printf ' Do you want to reinitialize this git repo? [y/N] ' | ||
read -r yn | ||
[[ ! "$yn" = "y" ]] && exit | ||
git init | ||
arrIN=(${@//\// }) | ||
if [[ "${arrIN[0]}" == "ssh" ]]; then | ||
AUTHOR_GIT_SSH=${AUTHOR_GIT/http[s]:\/\//git@} | ||
remote="$AUTHOR_GIT_SSH${arrIN[1]}.git" | ||
git remote add origin "${remote}" | ||
else | ||
remote="$AUTHOR_GIT${1}.git" | ||
git remote add origin "${remote}" | ||
fi | ||
return | ||
else | ||
git init | ||
arrIN=(${@//\// }) | ||
if [[ "${arrIN[0]}" == "ssh" ]]; then | ||
AUTHOR_GIT_SSH=${AUTHOR_GIT/http[s]:\/\//git@} | ||
remote="$AUTHOR_GIT_SSH${arrIN[1]}.git" | ||
remote add origin "${remote}" | ||
else | ||
remote="$AUTHOR_GIT${1}.git" | ||
remote add origin "${remote}" | ||
fi | ||
return | ||
fi | ||
} | ||
|
||
#=== FUNCTION ================================================================= | ||
# Name: check_valid_license | ||
# Description: check if valid license | ||
|
@@ -583,7 +621,7 @@ main() { | |
check_license_conflict | ||
case "$1" in | ||
-help | -h) usage ;; | ||
-initialize | -i) initialize_repo ;; | ||
-initialize | -i) initialize_repo "$2";; | ||
-list-licenses | -l) list_licenses ;; | ||
-list-languages | -ll) list_languages ;; | ||
-current-license | -c) einfo "$(show_license)" ;; | ||
|