From f4d94ed8ffe938dc65b539e57c06a0670c03763d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 30 May 2020 22:06:31 -0500 Subject: [PATCH] build/dev ~ change `show-utils`; allow invokation from directories other than repo main --- util/show-utils.BAT | 7 +++++++ util/show-utils.sh | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/util/show-utils.BAT b/util/show-utils.BAT index d0c492d3d..9fa5e2ffa 100644 --- a/util/show-utils.BAT +++ b/util/show-utils.BAT @@ -5,11 +5,18 @@ @rem ::# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath relpath rmdir shuf tsort unexpand @rem ::# spell-checker:ignore (jq) deps startswith +set "ME=%~0" +set "ME_dir=%~dp0." +set "ME_parent_dir=%~dp0.\.." + @rem refs: , @rem :: default ("Tier 1" cross-platform) utility list set "default_utils=base32 base64 basename cat cksum comm cp cut date dircolors dirname echo env expand expr factor false fmt fold hashsum head join link ln ls mkdir mktemp more mv nl od paste printenv printf ptx pwd readlink realpath relpath rm rmdir seq shred shuf sleep sort split sum tac tail tee test tr true truncate tsort unexpand uniq wc yes" +set "project_dir=%ME_parent_dir%" +cd "%project_dir%" + @:: `jq` available? set "JQ=" set "ERRORLEVEL=" diff --git a/util/show-utils.sh b/util/show-utils.sh index a463e8082..b4a613d9b 100755 --- a/util/show-utils.sh +++ b/util/show-utils.sh @@ -3,11 +3,20 @@ # spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath relpath rmdir shuf tsort unexpand # spell-checker:ignore (jq) deps startswith +ME="${0}" +ME_dir="$(dirname -- "${ME}")" +ME_parent_dir="$(dirname -- "${ME_dir}")" +ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}")" + # refs: , # default ("Tier 1" cross-platform) utility list default_utils="base32 base64 basename cat cksum comm cp cut date dircolors dirname echo env expand expr factor false fmt fold hashsum head join link ln ls mkdir mktemp more mv nl od paste printenv printf ptx pwd readlink realpath relpath rm rmdir seq shred shuf sleep sort split sum tac tail tee test tr true truncate tsort unexpand uniq wc yes" +project_main_dir="${ME_parent_dir_abs}" +# printf 'project_main_dir="%s"\n' "${project_main_dir}" +cd "${project_main_dir}" + # `jq` available? unset JQ jq --version 1>/dev/null 2>&1