-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcomboclean
executable file
·74 lines (68 loc) · 2.72 KB
/
comboclean
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
#!/bin/bash
function logoPrint(){
COLUMNS=$(tput cols)
title=$(echo -e "\e[94m
▄████▄ ▒█████ ███▄ ▄███▓ ▄▄▄▄ ▒█████
▒██▀ ▀█ ▒██▒ ██▒▓██▒▀█▀ ██▒▓█████▄ ▒██▒ ██▒
▒▓█ ▄ ▒██░ ██▒▓██ ▓██░▒██▒ ▄██▒██░ ██▒
▒▓▓▄ ▄██▒▒██ ██░▒██ ▒██ ▒██░█▀ ▒██ ██░
▒ ▓███▀ ░░ ████▓▒░▒██▒ ░██▒░▓█ ▀█▓░ ████▓▒░
░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ░ ░░▒▓███▀▒░ ▒░▒░▒░
░ ▒ ░ ▒ ▒░ ░ ░ ░▒░▒ ░ ░ ▒ ▒░
░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ▒
░ ░ ░ ░ ░ ░ ░ ░
░ ░
▄████▄ ██▓ ▓█████ ▄▄▄ ███▄ █
▒██▀ ▀█ ▓██▒ ▓█ ▀▒████▄ ██ ▀█ █
▒▓█ ▄ ▒██░ ▒███ ▒██ ▀█▄ ▓██ ▀█ ██▒
▒▓▓▄ ▄██▒▒██░ ▒▓█ ▄░██▄▄▄▄██ ▓██▒ ▐▌██▒
▒ ▓███▀ ░░██████▒░▒████▒▓█ ▓██▒▒██░ ▓██░
░ ░▒ ▒ ░░ ▒░▓ ░░░ ▒░ ░▒▒ ▓▒█░░ ▒░ ▒ ▒
░ ▒ ░ ░ ▒ ░ ░ ░ ░ ▒ ▒▒ ░░ ░░ ░ ▒░
░ ░ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░
░
")
clear
printf "%*s\n" $(((${#title}+$COLUMNS)/2)) "$title"
}
function statusPrint(){
if [[ "$1" == "error" ]]; then
logoPrint
echo -e "\e[91m[Error]\e[39m Try: comboclean --help"
else
logoPrint
echo -e "\e[32m[Sucess]\e[39m | by \e[96mgeraldoahnert"
fi
}
function fileClear(){
if [[ -f "$1" ]]; then
cat "$1" | cut -f 1 -d ':' >> "$2"
sed -i '/^$/d' "$2"
else
echo ' ' > "$2"
cat "$1" | cut -f 1 -d ':' >> "$2"
sed -i '/^$/d' "$2"
fi
}
if [[ $1 ]]; then
case $1 in
"-h" | "--help" )
echo "Use: comboclean -f FILE_NAME -o OUTPUT_FILE_NAME" ;;
"-f" | "--file" )
if [[ $2 ]]; then
if [[ "$3" == "-o" ]]; then
fileClear $2 $4
statusPrint
else
statusPrint error
fi
else
statusPrint error
fi ;;
* )
statusPrint error ;;
esac
else
statusPrint error
fi