From ea3fcd0704c356d2cfc0e7230305bb98ce7e0622 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 9 May 2024 11:06:40 +0100 Subject: [PATCH] Use the talk path instead of just the name Pass the path to the talk directory - e.g. `just generate ./src/test-driven-drupal` instead of just the talk name/slug. This doesn't change where the files are sourced from or output, but this makes it easier to use `just generate` as I can use tab completion when executing the command - making it quicker and less prone to typos. --- justfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/justfile b/justfile index fd179d7..b17aaed 100644 --- a/justfile +++ b/justfile @@ -13,19 +13,26 @@ clean: -type f \( -name "{{ pdf_filename }}" -o -name *.build_temp -o -name {{ thumbnail_filename }} \) \ -delete -generate name: (generate-pdf name) +generate talk_path: (generate-pdf talk_path) -generate-pdf name: - cd src/{{ name }} && rst2pdf {{ rst_filename }} \ +generate-pdf talk_path: + #!/usr/bin/env bash + set -o errexit + set -o nounset + + talk_slug=$(basename {{ talk_path }}) + + pushd "{{ talk_path }}" + + rst2pdf {{ rst_filename }} \ --break-level 1 \ -e preprocess \ --fit-background-mode scale \ --font-path ../fonts \ - --output ../../dist/{{ name }}.pdf \ + --output "../../dist/${talk_slug}.pdf" \ --stylesheets opdavies-light,tango \ --stylesheet-path ../styles - tree dist + popd -present name: - pdfpc "dist/{{ name }}.pdf" + tree dist