diff options
author | EuAndreh <eu@euandre.org> | 2021-07-27 11:31:02 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-07-27 11:58:44 -0300 |
commit | 9e84b309cd0807ff029660d2f42a2397334efb2b (patch) | |
tree | d10f193190726891ff739ecb6655359166947bb5 /aux/workflow/assert-spelling.sh | |
parent | TODOs.md: Add #task-1f103822-c865-254c-f6b6-4968f2fb473e (diff) | |
download | git-permalink-9e84b309cd0807ff029660d2f42a2397334efb2b.tar.gz git-permalink-9e84b309cd0807ff029660d2f42a2397334efb2b.tar.xz |
aux/: Stick to 80 columns
Diffstat (limited to 'aux/workflow/assert-spelling.sh')
-rwxr-xr-x | aux/workflow/assert-spelling.sh | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/aux/workflow/assert-spelling.sh b/aux/workflow/assert-spelling.sh index f1eef6f..9418dc2 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 } @@ -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 |