Merge pull request #5 from gabe565/generate-basedir

Generate `$basedir` from git repo root
This commit is contained in:
Rawiri Blundell 2023-04-27 11:13:15 +12:00 committed by GitHub
commit a0de579a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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