-
Notifications
You must be signed in to change notification settings - Fork 1
/
spell-check.sh
executable file
·121 lines (109 loc) · 1.84 KB
/
spell-check.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
#!/bin/bash
# Function to check if Aspell is installed
check_aspell() {
if command -v aspell > /dev/null; then
return 1
else
echo "Aspell is not installed. Automatically installing"
return 0
fi
}
# Function to install Aspell on Debian-based systems
install_aspell_debian() {
echo "Attempting to install Aspell on Debian-based system..."
sudo apt-get update && sudo apt-get install -y aspell
}
# Function to install Aspell on macOS
install_aspell_mac() {
echo "Attempting to install Aspell on macOS..."
brew install aspell
}
# Main logic
if check_aspell; then
# Identify the platform
case "$(uname -s)" in
Linux)
if [ -f /etc/debian_version ]; then
install_aspell_debian
else
echo "Unsupported Linux distribution."
fi
;;
Darwin)
install_aspell_mac
;;
*)
echo "Unsupported operating system."
;;
esac
fi
read -r -d '' dictionary <<'EOF'
personal_ws-1.1 en 2
anteraja
argocd
artajasa
bersama
bigquery
brankas
brankass
cardmember
checkly
checkov
ci
cloudkms
confluentinc
coreapi
deadletter
deadletters
decrypter
ekyc
encrypter
finexus
freshchat
goka
golang
hnst
honestbank
honestcard
jq
json
kafdrop
menubook
mst
nonk8s
noti
opentracing
perf
perso
pushgateway
rclone
resc
roleset
rolesets
rtrw
rudderstack
schemaregistry
snyk
strimzi
terratest
ulid
usecase
waitlist
waitlisted
yaml
EOF
echo "$dictionary" > dictionary.text
# Your string to check
string=$(cat $1)
echo "$string"
# Check spelling
misspelled=$(echo "$string" | aspell --personal ./dictionary.text list)
rm dictionary.text
# If the misspelled variable is not empty, there are spelling errors
if [ -n "$misspelled" ]; then
echo "Spelling errors found:"
echo "$misspelled"
exit 1
else
exit 0
fi