#!/bin/bash set -e -u cd ~/REPOS/ucs44 spell () { declare -a ignore=( shim .git \*.ai \*.cer \*.class \*.csv \*.cvd \*.deb \*.der \*.efi \*.efi.signed \*.gd2 \*.gif \*.gpg \*.gz \*.ico \*.iso \*.jpeg \*.jpg \*.ldif \*.m4 \*.mo \*.odg \*.pdf \*.png \*.png.fallback \*.po \*.pyc \*.svg \*.svgz \*.swf \*.ttf \*.woff \*.xcf \*.xz \*.zi \*.univention-config-registry-variables countryInfo.txt city_data.json nameservers.json country_data.json iso-languagecodes.txt timeZones.txt privacy_statement.json languagelist ltmain.sh aclocal.m4 configure config.sub errors.translation.json \*-de.xml \*-de-\*.xml handbuch-\*.xml wafsamba waf-svn \*.desktop \*.theme de_DE fr_FR protokoll1.txt protokoll2.txt protokoll3.txt self-service-blog-artikel.txt README_DE README_POST_INSTALL_DE sonderfaelle_gruppen.txt php-krb5 druckertest.sh seccomp-systemd.json ) declare -a args=() local arg for arg in "${ignore[@]}" do [ 0 -lt "${#args[@]}" ] && args+=(-o) args+=(-name "$arg") done find \( "${args[@]}" \) -prune -o -type f -exec codespell -s -c {} + } old='' msg='' while read -r file lnr src dst do sed -ne "${lnr}p" "$file" | grep -Fq "$src" || { grep -nhF "$src" "$file" ; exit 1; } [ -n "$old" ] && [ "$(echo "$old" | tr '[:upper:]' '[:lower:]')" != "$(echo "$dst" | tr '[:upper:]' '[:lower:]')" ] && git commit -m "$msg" sed -i -e "${lnr}s/\<${src}\>/${dst}/" "$file" git add "$file" old="$dst" msg="Bug #48698 spell: $src -> $dst" done <"${0%.sh}.csv" [ -n "$msg" ] && git commit -m "$msg"