-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·55 lines (46 loc) · 1.2 KB
/
build.sh
File metadata and controls
executable file
·55 lines (46 loc) · 1.2 KB
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
#!/usr/bin/env bash
print_center() {
local text="$1"
local width=$(tput cols)
local padding=$((($width + ${#text}) / 2))
printf "%*s\n" $padding "$text"
}
text="𝐵𝓊𝒾𝓁𝒹𝒪𝓃𝒯𝒽𝑒𝐹𝓁𝓎"
output=$(toilet -f term -F border "$text")
padding=$((($(tput cols) - $(echo "$output" | wc -L)) / 2))
echo "$output" | awk -v pad="$padding" '{printf "%*s%s\n", pad, "", $0}' | lolcat
print_center "Output"
printf "%*s\n" "$(tput cols)" | tr ' ' '-'
filename="$1"
flags="$2"
if [ -z "$filename" ]; then
cowsay "Error: No filename provided." | lolcat
exit 1
fi
case "$filename" in
*.c)
filename_without_extension="${filename%.c}"
clang "$filename" $flags -o "$filename_without_extension" && ./"$filename_without_extension"
;;
*.cpp)
filename_without_extension="${filename%.cpp}"
clang++ "$filename" -o "$filename_without_extension" && ./"$filename_without_extension"
;;
*.py)
python "$filename"
;;
*.sh)
chmod +x "$filename" && ./"$filename"
;;
*.java)
javac "$filename" && java "${filename%.java}"
;;
*.cs)
mcs "$filename" && mono "${filename%.cs}.exe"
;;
*)
cowsay "Unknown file type or no file extension." | lolcat
;;
esac
printf "\n"
printf "%*s\n" "$(tput cols)" | tr ' ' '-'