-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-automation.sh
executable file
·50 lines (42 loc) · 1.22 KB
/
git-automation.sh
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
#!/bin/bash
# Assign environmental variables to local variables
GITHUB_TOKEN="$GITHUB_TOKEN"
GIT_USERNAME="$GIT_USERNAME"
GIT_EMAIL="$GIT_EMAIL"
# Source the files containing functions
source handleGitConfigs.sh
source createGitRepo.sh
source handleGitOperations.sh
source gitRepoDelete.sh
source createRemoteRepo.sh
source pushingToRemote.sh
source checkGitRepo.sh
# Main function to execute the script
main() {
local ACTION=$1
# Check if the .git directory exists
if [ "$ACTION" = "create" ];
then
echo "Let us create a new repository for you"
echo "You will be asked for a repo name"
check_and_configure_git
create_github_repo
elif [ "$ACTION" = "update" ];
then
echo "Relax, allow me to commit and push your changes"
echo "But first, lets cross-check if this a git repo..."
echo "Checking if its a repo...."
checkGitRepo
perform_git_operations
elif [ "$ACTION" = "delete" ];
then
echo "This action is irreversible"
echo "Deleting repository. You will be asked to confirm"
removeRepoDir
else
echo "Invalid command argument provided"
echo "Specify either 'create' to create a new repo or 'update' to update your changes"
fi
}
# Call the main function
main "$1"