chore: minor cleanup for running commands
This commit is contained in:
parent
4a6cb93a3d
commit
f00cd81ca1
4 changed files with 45 additions and 0 deletions
2
.envrc
2
.envrc
|
@ -1 +1,3 @@
|
|||
use flake || use nix
|
||||
|
||||
PATH_add node_modules/.bin
|
||||
|
|
43
Justfile
Normal file
43
Justfile
Normal file
|
@ -0,0 +1,43 @@
|
|||
_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
|
Loading…
Reference in a new issue