-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·181 lines (172 loc) · 5.84 KB
/
make.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/env bash
######################################################################################
### automação de copilador em shellscript ###
### based in https://github.com/DIEGOHORVATTI/run ###
######################################################################################
# info versão
function fVersao(){
echo -e "\n"
echo -e "┌───────────────────────────────────────┐"
echo -e "│ │"
echo -e "│ Run v0.0.1 | by Diego Horvatti │"
echo -e "│ https://github.com/DIEGOHORVATTI │"
echo -e "│ │"
echo -e "└───────────────────────────────────────┘"
echo -e "\n"
}
# Help do programa
function fHelp(){
echo -e "\n"
echo -e "┌───────────────────────────────────────┐"
echo -e "│ │"
echo -e "│ [ info ] │"
echo -e "│ -v, --version.: versão do softwere │"
echo -e "│ -h, --help....: informações das flags │"
echo -e "│ │"
echo -e "│ [ dev ] │"
echo -e "│ --create-file.: criar arquivo.c │"
echo -e "│ --gitignore...: criar .gitgnore │"
echo -e "│ --git.........: commit & push │"
echo -e "│ --build.......: verificação de bugs │"
echo -e "│ │"
echo -e "│ [ user ] │"
echo -e "│ --start.......: iniciar compilação │"
echo -e "│ --config......: arquivo configuração │"
echo -e "│ │"
echo -e "│ [ dependencies ] │"
echo -e "│ obrigratório: 'gcc or g++' │"
echo -e "│ optativa: 'cppcheck', 'wget', 'git' │"
echo -e "│ │"
echo -e "│ │"
echo -e "│ used: ./make.sh --start │"
echo -e "│ │"
echo -e "└───────────────────────────────────────┘"
echo -e "\n"
}
# Adicionar arquivo .gitgnore
function fGitgnore(){
wget https://gist.githubusercontent.com/DIEGOHORVATTI/30462a7868ae1df718a6c32c505a9ea3/raw/77d407af7e041727e6025f30531683aaab893a7d/.gitignore
clear
echo -e "\n"
echo -e "┌───────────────────────────────────────┐"
echo -e "│ │"
echo -e "│ Create file: .gitgnore │"
echo -e "│ │"
echo -e "└───────────────────────────────────────┘"
echo -e "\n"
}
# Criar arquivo C com a estrutura base para testes
function creat_file_f(){
read -p ' New file: ' nome
echo -e "\n"
wget https://gist.githubusercontent.com/DIEGOHORVATTI/f1272263f3db0118f2d5d5bb3df0de8d/raw/ad09444126da9bb50bdd98b62cf5957f5feb895d/min.c -O $nome
code $nome
clear
}
# Atualizar repositória a cada minuto setado por usuário com a data do sistema
function fGitAll(){
read -p ' Time: ' time_
while :; do
git branch -M main &&
git add . &&
git commit -m "$(date +'[%d/%m/%Y] [%H:%M] -- {%j, %A}')" &&
git push -u origin main &&
clear &&
for ((i=$time_; i >= 0; i--)); do
echo -e "\n\033[0;34m🕗 $(($i))m\033 \033[1;32m $(date +'[%d/%m/%Y] [%H:%M] { %A }')\033[0m"
sleep 1m
done
done
}
# Atualizar repositória da branch "main" com um commit setado do teclado
function f_GitRead(){
read -p ' New commit: ' git
git branch -M main &&
git add . &&
git commit -m "$git" &&
git push -u origin main &&
clear &&
echo -e "\n\033[0;34m ✓✓:\033[0m $git \n"
}
# Iniciar compilação
function fStart(){
clear &&
#cppcheck ./$i &&
echo -e "\n───────────────────────────────────────\n" &&
gcc ./build/main.c -o ./bin/run.bin && ./bin/run.bin &&
echo -e "\n\n───────────────────────────────────────\n"
}
# Iniciar compilação
function fDebug(){
clear &&
cppcheck ./build/main.c &&
echo -e "\n───────────────────────────────────────\n" &&
gcc ./build/main.c -o ./bin/run.bin && ./bin/run.bin &&
echo -e "\n\n───────────────────────────────────────\n"
}
# Swith case de opções de flags
for i in "$@"; do
case $i in
-v | --version)
fVersao
;;
-h | --help)
fHelp
;;
--create-file)
creat_file_f
;;
--gitignore)
fGitgnore
;;
--git)
f_GitRead
;;
--git-date)
fGitAll
;;
--config)
nano ./config.ini
clear
;;
--debug)
fDebug
echo -e " Nova deburação [ \033[0;34m"Y"\033[0m / \033[0;31m"N"\033[0m ]"
read -p " >> " teclado
case $teclado in
y | Y)
./make.sh --debug
;;
n | N)
exit
;;
git)
f_GitRead
./make.sh --start
;;
*)
exit
;;
esac
;;
--start)
fStart
echo -e " Nova verificação [ \033[0;34m"Y"\033[0m / \033[0;31m"N"\033[0m ]"
read -p " >> " teclado
case $teclado in
y | Y)
./make.sh --start
;;
n | N)
exit
;;
git)
f_GitRead
./make.sh --start
;;
*)
exit
;;
esac
esac
done