From 7fdeffb1afbff07777eca34074c4b5736700a552 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.dev>
Date: Fri, 10 May 2024 10:04:53 +0100
Subject: [PATCH] Update justfile recipes

* Hide the `default` recipe by renaming it to `_default` (recipes
  prefixed with an underscore are hidden from `just --list`.
* Re-add the `present` recipe for presenting with `pdfpc`, but making
  the duration a required argument.
* Add a `watch` recipe that watches files for changes and re-generates
  the PDF. This is based on a given path,
  e.g. `./src/test-driven-drupal`, and optionally allows for overriding
  the rst filename if I only want to watch a specfic source file, such
  as `demo.rst`.
---
 justfile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/justfile b/justfile
index 295520d..749d166 100644
--- a/justfile
+++ b/justfile
@@ -1,7 +1,7 @@
 pdf_filename := 'slides.pdf'
 thumbnail_filename := 'thumbnail.jpg'
 
-default:
+_default:
   @just --list
 
 clean:
@@ -35,3 +35,10 @@ generate-pdf talk_path filename="slides.rst":
   popd
 
   tree dist
+
+present slides_path duration *args:
+    pdfpc {{ slides_path }} --duration={{ duration }} {{ args }}
+
+watch slides_path rst_file="slides.rst":
+  find justfile src/styles {{ slides_path }} -type f | \
+    entr just generate-pdf {{ slides_path }} {{ rst_file }}