-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions-misc.sh
56 lines (41 loc) · 1.38 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
# Misc functions file
show_message(){
# Shows the welcome message
echo "
_ _ ___ ____ _______ ______ _____ _____ _______
| | | | __ \| __ \ /\|__ __| ____| / ____|_ _|__ __|
| | | | |__) | | | | / \ | | | |__ | | __ | | | |
| | | | ___/| | | |/ /\ \ | | | __| | | |_ | | | | |
| |__| | | | |__| / ____ \| | | |____ | |__| |_| |_ | |
\____/|_| |_____/_/ \_\_| |______| \_____|_____| |_|
by: sWallyx
"
echo "Thanks for using me!"
echo "Let me update the repositories for you"
}
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
if [ -d .git ]; then
base_name=$(basename "$(git rev-parse --show-toplevel)")
echo "Updating repository $base_name"
update_repository
else
folder_name=${PWD##*/}
echo "$folder_name is not a Git Repository"
fi
}
bye_message(){
# Shows the message at the end of the command
# when everything has been done
echo "All repositories updated"
echo "Have a nice coding :)"
}