mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 23:50:25 +08:00
spellcheck: Exit with error on missing dictionary file
This commit is contained in:
parent
1ce13eceee
commit
4b82f8a99d
@ -55,9 +55,15 @@ if [[ ! -f "$dict_filename" ]]; then
|
||||
cat "${markdown_sources[@]}" | aspell --ignore 3 list | sort -u >> "$dict_filename"
|
||||
elif [[ "$mode" == "list" ]]; then
|
||||
# List (default) mode: scan all files, report errors
|
||||
cp "$dict_filename" "$dict_path"
|
||||
declare -i retval=0
|
||||
|
||||
cp "$dict_filename" "$dict_path"
|
||||
|
||||
if [ ! -f $dict_path ]; then
|
||||
retval=1
|
||||
exit "$retval"
|
||||
fi
|
||||
|
||||
for fname in "${markdown_sources[@]}"; do
|
||||
command=$(aspell --ignore 3 --personal="$dict_path" "$mode" < "$fname")
|
||||
if [[ -n "$command" ]]; then
|
||||
@ -74,6 +80,12 @@ elif [[ "$mode" == "list" ]]; then
|
||||
elif [[ "$mode" == "check" ]]; then
|
||||
# Interactive mode: fix typos
|
||||
cp "$dict_filename" "$dict_path"
|
||||
|
||||
if [ ! -f $dict_path ]; then
|
||||
retval=1
|
||||
exit "$retval"
|
||||
fi
|
||||
|
||||
for fname in "${markdown_sources[@]}"; do
|
||||
aspell --ignore 3 --dont-backup --personal="$dict_path" "$mode" "$fname"
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user