Formatting: Update script

This commit is contained in:
2026-01-09 15:04:22 +01:00
parent 4d08c5e888
commit 7ffd7604f8

View File

@@ -1,25 +1,32 @@
#!/bin/sh #!/bin/sh
if [ ! "$1" == "" ]; then if [ ! "$1" == "" ]; then
cp .latexindent.yaml "$1/" || true cp .latexindent.yaml "$1/" || true
cp latexindent.yaml "$1/" || true cp latexindent.yaml "$1/" || true
cd $1 cd $1
fi fi
echo "Formatting directory $(pwd)" echo "Formatting directory $(pwd)"
if [ -f .latexindent.yaml ]; then
echo "latexindent config found"
elif [ -f latexindent.yaml ]; then
echo "latexindent config found"
else
echo "No latexindent config found. Using defaults"
fi
files=$(find . -type f | grep "\.tex") files=$(find . -type f | grep "\.tex")
idx=1 idx=1
total=$(echo "$files" | wc -l) total=$(echo "$files" | wc -l)
for file in $files; do for file in $files; do
echo "Processing file $idx / $total" echo "Processing file $idx / $total"
latexindent -s -w -l $file latexindent -s -w -l $file
idx=$((idx + 1)) idx=$((idx + 1))
done done
echo "Cleaning up..." echo "Cleaning up..."
backups=$(find . -type f | grep "\.bak") backups=$(find . -type f | grep "\.bak")
for backup in $backups; do for backup in $backups; do
rm $backup rm $backup
done done