This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.sh
80 lines (66 loc) · 1.72 KB
/
utils.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
#
# All rights reserved.
declare -r pVer=$(sed -E 's/\w+ ([2-3])\.([0-9]+)\.([0-9]+)/\1.\2.\3/g' < <(python3.8 -V))
log() {
local text="$*"
test ${#text} -gt 0 && test ${text::1} != '~' \
&& echo -e "[$(date +'%d-%b-%y %H:%M:%S') - INFO] - init - ${text#\~}"
}
quit() {
local err="\t:: ERROR :: $1\nExiting With SIGTERM ..."
if (( getMessageCount )); then
replyLastMessage "$err"
else
log "$err"
fi
exit 1
}
runPythonCode() {
python${pVer%.*} -c "$1"
}
runPythonModule() {
python${pVer%.*} -m "$@"
}
gitInit() {
git init &> /dev/null
}
gitClone() {
git clone "$@" &> /dev/null
}
addUpstream() {
git remote add $UPSTREAM_REMOTE ${UPSTREAM_REPO%.git}.git
}
updateUpstream() {
git remote rm $UPSTREAM_REMOTE && addUpstream
}
fetchUpstream() {
git fetch $UPSTREAM_REMOTE &> /dev/null
}
upgradePip() {
pip3 install -U pip &> /dev/null
}
installReq() {
pip3 install -r $1/requirements.txt &> /dev/null
}
printLine() {
echo ========================================================
}
printLogo() {
printLine
echo '
_ _ ____ _____ ____ ____ _____ ____ _ _ _____
| | | / ___|| ____| _ \ / ___| ____|/ __ \| | | |_ _|
| | | \___ \| _| | |_) | | _| _| / / _` | | | | | |
| |_| |___) | |___| _ <| |_| | |__| | (_| | |_| | | |
\___/|____/|_____|_| \_\\____|_____\ \__,_|\___/ |_|
\____/
'
printLine
}