about summary refs log tree commit diff stats
path: root/build/latex/letter/build.sh
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-03 11:22:34 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-03 11:22:34 +0200
commit68ea1c9729189a93bb6dc7603022cd63d5430ea1 (patch)
tree5daf4c88aee88de37ee5b3af439cd384af8675eb /build/latex/letter/build.sh
parentfix(templates/latex/academia): Adjust to new preamble (diff)
downloadflake-templates-68ea1c9729189a93bb6dc7603022cd63d5430ea1.tar.gz
flake-templates-68ea1c9729189a93bb6dc7603022cd63d5430ea1.zip
chore(build): Re-generate
Diffstat (limited to 'build/latex/letter/build.sh')
-rwxr-xr-xbuild/latex/letter/build.sh30
1 files changed, 23 insertions, 7 deletions
diff --git a/build/latex/letter/build.sh b/build/latex/letter/build.sh
index 1206ee7..c67ad52 100755
--- a/build/latex/letter/build.sh
+++ b/build/latex/letter/build.sh
@@ -1,14 +1,30 @@
 #!/usr/bin/env sh
 
-# if no parameter is given, use 'dst' as destination directory
-if [ -z "$1" ]; then
-    dst=build
-else
-    dst="$1"
-fi
+file="./%INIT_APPLICATION_NAME.tex"
+dst=build
+
+clear=false
+
+for arg in "$@"; do
+    case "$arg" in
+    "--clear")
+        clear=true
+        ;;
+    --*)
+        echo "No such option: '$arg'"
+        exit 2
+        ;;
+    *)
+        file="$arg"
+        ;;
+    esac
+done
 
 # find all directories which are not the destination dir or inside it
 find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do
     mkdir --parents "$dst/$dir"
 done
-latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "./%INIT_APPLICATION_NAME.tex"
+
+test "$clear" = true && rm "$dst/${file%tex}out"
+
+latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file"