aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/assert-spelling.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-09-01 11:18:01 -0300
committerEuAndreh <eu@euandre.org>2021-09-01 11:18:01 -0300
commit692185136a6d7e96660b90370759d1f83a05ec4c (patch)
tree34852b497fd9054ab55ff27045efd4a19dd9f331 /aux/workflow/assert-spelling.sh
parentsrc/remembering.c: Enforce C style (diff)
downloadremembering-692185136a6d7e96660b90370759d1f83a05ec4c.tar.gz
remembering-692185136a6d7e96660b90370759d1f83a05ec4c.tar.xz
aux/: Update
Diffstat (limited to 'aux/workflow/assert-spelling.sh')
-rwxr-xr-xaux/workflow/assert-spelling.sh29
1 files changed, 16 insertions, 13 deletions
diff --git a/aux/workflow/assert-spelling.sh b/aux/workflow/assert-spelling.sh
index f1eef6f..853fd5e 100755
--- a/aux/workflow/assert-spelling.sh
+++ b/aux/workflow/assert-spelling.sh
@@ -5,16 +5,18 @@ set -eu
sort_dicts() {
for f in po/spelling/*.txt; do
- if ! LANG=POSIX sort "$f" | diff - "$f"; then
- if [ "$IN_PLACE" = true ]; then
- OUT="$(mkstemp)"
- LANG=POSIX sort "$f" | uniq > "$OUT"
- mv "$OUT" "$f"
- else
- echo "The $f dictionary is unsorted. To fix it, run:" >&2
- echo " sh aux/workflow/assert-spelling.sh -i" >&2
- exit 1
- fi
+ if LANG=POSIX sort "$f" | diff - "$f"; then
+ echo continue
+ fi
+ if [ "$IN_PLACE" = true ]; then
+ OUT="$(mkstemp)"
+ LANG=POSIX sort "$f" | uniq > "$OUT"
+ mv "$OUT" "$f"
+ else
+ printf 'The %s dictionary is unsorted.' "$f" >&2
+ printf " To fix it, run:\n" >&2
+ printf " sh aux/workflow/assert-spelling.sh -i" >&2
+ exit 1
fi
done
}
@@ -50,8 +52,8 @@ mkdir -p po/spelling
eval "touch po/spelling/{international,$(echo "$LANGS" | tr ' ' ,)}.txt"
get_lang() {
- grep lang=.. "$1" | \
- head -n1 | \
+ grep lang=.. "$1" |
+ head -n1 |
awk '
match($0, /lang="(..)"/) {
print substr($0, RSTART+length("lang=\""), 2)
@@ -63,7 +65,8 @@ ACC="$(mkstemp)"
for f in "$@"; do
l="$(get_lang "$f")"
CURR_DICT="$(mkstemp)"
- cat po/spelling/international.txt "po/spelling/$l.txt" | sort | uniq > "$CURR_DICT"
+ cat po/spelling/international.txt "po/spelling/$l.txt" |
+ sort | uniq > "$CURR_DICT"
hunspell -u3 -H -d "$l" -p "$CURR_DICT" "$f" | tee -a "$ACC" >&2
done