Generate $basedir from git repo root

This commit is contained in:
Gabe Cook 2023-04-26 13:47:28 -05:00
parent 26a6ea707f
commit 3bac06559a
No known key found for this signature in database
GPG Key ID: 3197318BDE319B8D

View File

@ -9,7 +9,7 @@
# Ensure we have our required commands, otherwise fail early # Ensure we have our required commands, otherwise fail early
cmd_err=0 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 if ! command -v "${cmd}" >/dev/null 2>&1; then
printf -- '%s\n' "This script requires ${cmd} but it was not found in PATH." >&2 printf -- '%s\n' "This script requires ${cmd} but it was not found in PATH." >&2
(( cmd_err++ )) (( cmd_err++ ))
@ -18,7 +18,7 @@ done
(( cmd_err > 0 )) && exit 1 (( cmd_err > 0 )) && exit 1
# Where are we playing on the local file system? # 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. # Prepend a string e.g.
# cmd: prepend foo bar # cmd: prepend foo bar