summary refs log tree commit diff
path: root/bin/latexmk
diff options
context:
space:
mode:
Diffstat (limited to 'bin/latexmk')
-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}