Skip to content

Commit

Permalink
Added the git init
Browse files Browse the repository at this point in the history
Signed-off-by: The-Repo-Club <[email protected]>
  • Loading branch information
HeCodes2Much committed Feb 21, 2022
1 parent 0f525cf commit df3a048
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions proctl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
# -------------------------------------------------------------------------
#
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)" ;;
Expand Down

0 comments on commit df3a048

Please sign in to comment.