-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·44 lines (35 loc) · 1.18 KB
/
entrypoint.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
#!/bin/sh
set -eu
if [ -f ".vale.ini" ]; then
config=".vale.ini"
else
printf "[note] using default configuration\n" 1>&2
config="/vale.ini"
fi
styles_path="$(sed -Ene 's/^[[:space:]]*stylespath[[:space:]]*=[[:space:]]*//Ip' "${config}")"
vocab_path="${styles_path}/Vocab/Custom/"
if [ ! -d "${styles_path}" ]; then
printf "[note] creating missing StylesPath '%s'\n" "${styles_path}" 1>&2
mkdir -p "${styles_path}"
fi
if [ ! -d "${vocab_path}" ]; then
printf "[note] creating missing Custom Vocab path '%s'\n" "${vocab_path}" 1>&2
mkdir -p "${vocab_path}"
fi
if [ -n "$(find "${styles_path}" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then
printf "[note] populating empty StylesPath '%s'\n" "${styles_path}" 1>&2
/bin/vale --config="${config}" sync
fi
if [ -f ".vale.accept" ]; then
printf "[note] adding accept list to '%s'\n" "${vocab_path}accept.txt" 1>&2
cp -f ".vale.accept" "${vocab_path}accept.txt"
fi
if [ -f ".vale.reject" ]; then
printf "[note] adding reject list to '%s'\n" "${vocab_path}reject.txt" 1>&2
cp -f ".vale.reject" "${vocab_path}reject.txt"
fi
if [ -z "$1" ]; then
/bin/vale --config="${config}" .
else
/bin/vale --config="${config}" "$@"
fi