summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2026-04-17 08:45:03 +0200
committerxengineering <me@xengineering.eu>2026-07-09 09:46:34 +0200
commit071afd1860dfdd4f2d3b697faa21de47b0631ac3 (patch)
tree70b11bb552ea8f6283118c621c1c94e66d5d01c5
parent86aa4f7eb51cc5635f5df0f4a3010458451099e5 (diff)
downloaddotfiles-071afd1860dfdd4f2d3b697faa21de47b0631ac3.tar
dotfiles-071afd1860dfdd4f2d3b697faa21de47b0631ac3.tar.zst
dotfiles-071afd1860dfdd4f2d3b697faa21de47b0631ac3.zip
posix-shell: utils: Add automeson()
This function allows to run `meson compile -C <build-dir>` always for a given build directory whenever an also given file is written. This is especially useful to edit LaTeX files and let them update automatically on each save of the editor with automeson, meson and latexmk. The performance is so good that it speeds up the LaTeX and especially TikZ development significantly.
-rw-r--r--posix-shell/utils.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/posix-shell/utils.sh b/posix-shell/utils.sh
index b21c09b..0d71901 100644
--- a/posix-shell/utils.sh
+++ b/posix-shell/utils.sh
@@ -276,3 +276,26 @@ hexdiff() {
rm -f "$dump1" "$dump2"
}
+
+automeson() {
+ if test "$#" -ne 2
+ then
+ echo "Usage: automeson <build-dir> <file-to-watch>"
+ return 1
+ fi
+
+ build="$1"
+ file="$2"
+
+ while true
+ do
+ inotifywait --quiet --event close_write "$file"
+ clear
+ if meson compile -C "$build"
+ then
+ printf '\033[32mOK\033[0m\n'
+ else
+ printf '\033[31mFAILED\033[0m\n'
+ fi
+ done
+}