miwafu/Justfile

43 lines
978 B
Makefile
Raw Normal View History

_default:
just --list
validate-words:
#!/usr/bin/env bash
set -euo pipefail
for i in src/dictionary/*/*.yaml
do
word=$(grep 'entry:' $i | cut -f 2 -d : | cut -c 2-)
if ! fedran-miwafu validate $word
then
echo "$i: bad"
fi
done
sort-dictionary-files:
#!/usr/bin/env bash
set -euo pipefail
for i in src/dictionary/*/*.yaml
do
word=$(grep 'entry:' $i | cut -f 2 -d : | cut -c 2-)
prefix=$(fedran-miwafu split $word | cut -f 1 -d ' ')
path="src/dictionary/$prefix/$word.yaml"
if [ "$i" != "$path" ]
then
echo "renaming $i -> $path"
if [ -f "$path" ]
then
echo " already exists"
else
echo " moved"
mkdir -p "src/dictionary/$prefix"
mv -i "$i" "$path"
fi
fi
rmdir src/dictionary/* 2> /dev/null || true
done