1
1
Fork 0
matrix/tools/domain-list-sort.sh

16 lines
389 B
Bash
Executable File

#!/usr/bin/env sh
## This script should be placed in pre-commit-hooks
set -xe
GIT_DIR="$(git rev-parse --show-toplevel)"
if [ -d "$GIT_DIR" ]; then
cd "${GIT_DIR}" || exit 1
for i in $(git ls-files -m | grep -i "domains.list"); do
python3.11 "$GIT_DIR/tools/domain-sort.py" <"${i}" >"${i}.tmp" &&
sed "/^$/d" "${i}.tmp" >"${i}" && rm "${i}.tmp"
done
fi