summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-02-09 00:22:48 +0100
committerRobert Günzler <r@gnzler.io>2022-02-09 00:22:48 +0100
commit3be7c0d795359c30567397ec708bfcb60400c7b0 (patch)
treeedf4e978cc8a261c3622645153e8e5b5e18c9ff2 /bin
parent83fca9b77fb5ff5cbf9e793e156b9d976a252961 (diff)
bin/latexmk: watch more filetypes + compat args
Diffstat (limited to 'bin')
-rwxr-xr-xbin/latexmk22
1 files changed, 20 insertions, 2 deletions
diff --git a/bin/latexmk b/bin/latexmk
index 407d348..c3b70d8 100755
--- a/bin/latexmk
+++ b/bin/latexmk
@@ -7,15 +7,28 @@ ENGINE=${ENGINE:-tectonic}
 ENGINE_ARGS=${ENGINE_ARGS:-}
 VIEWER=${VIEWER:-zathura}
 
+# check requirements
+for tool in entr realpath tectonic; do
+	if ! command -v "$tool" >/dev/null; then
+		printf "%s: %s not installed but required\n" "$(basename "$0")" "$tool" >&2
+		exit 1
+	fi
+done
+
 pidfile=/tmp/latexmk.pid
 once=
 reexec=
 nocolor=
-while getopts 1Rnh opt; do
+while getopts 1Rnhpvcf opt; do
 	case "$opt" in
 	1) once=1 ;;
 	R) reexec=1 ;;
 	n) nocolor=1 ;;
+	# noop, compat
+	p) ;;
+	v) ;;
+	c) ;;
+	f) ;;
 	h | ?)
 		printf "usage: %s [-h]\n" "$(basename "$0")"
 		printf "\n"
@@ -78,7 +91,12 @@ if [ -z "${once}" ]; then
 fi
 
 if [ -z "$1" ]; then
-	ls ./*.{tex,cls,jpg,png,svg}
+	if command -v fd >/dev/null 2>&1; then
+		fd -e tex -e cls -e jpg -e png -e svg . . 2>/dev/null
+	else
+		ls ./**/*.{tex,cls,jpg,png,svg} 2>/dev/null
+	fi
+
 else
 	[ -f "$1" ] && printf "%s\n" "$1"
 	ls ./*.{tex,cls,jpg,png,svg}