-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions-misc.sh
44 lines (30 loc) · 944 Bytes
/
functions-misc.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
#!/usr/bin/env bash
# Misc functions file
show_message(){
# Shows the welcome message
figlet "UPDATE GIT"
printf "by: sWallyx\n\n"
printf "Let me update the repositories for you\n"
printf " - - - - - - - - - - - - - - - \n\n"
}
enter_folder_and_print_inside_exit(){
# Enters the given folder and prints the
# repository name.
# When inside calls for the update_repository
# function.
# Enter folder with git
cd "$1" || exit
# Go up one level, because we are on .git
cd ..
# Check folder is git repository
base_name=$(basename "$(git rev-parse --show-toplevel)")
echo "Updating repository $base_name"
update_repository
}
bye_message(){
# Shows the message at the end of the command
# when everything has been done
printf "\n - - - - - - - - - - - - - - - "
printf "\nAll repositories updated\n"
printf "Have a nice coding :)\n\n"
}