From 3bac06559af18182b324215b43226ae9a24e8f56 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 26 Apr 2023 13:47:28 -0500 Subject: [PATCH] Generate `$basedir` from git repo root --- archive_crawler | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archive_crawler b/archive_crawler index 0ec2f1c..11ced65 100644 --- a/archive_crawler +++ b/archive_crawler @@ -9,7 +9,7 @@ # Ensure we have our required commands, otherwise fail early cmd_err=0 -for cmd in grep sed tr sort uniq mkdir curl jq pandoc; do +for cmd in grep sed tr sort uniq mkdir curl jq pandoc git; do if ! command -v "${cmd}" >/dev/null 2>&1; then printf -- '%s\n' "This script requires ${cmd} but it was not found in PATH." >&2 (( cmd_err++ )) @@ -18,7 +18,7 @@ done (( cmd_err > 0 )) && exit 1 # Where are we playing on the local file system? -basedir="${HOME}/git/wiki.bash-hackers.org" +basedir="$(git rev-parse --show-toplevel)" # Prepend a string e.g. # cmd: prepend foo bar