install.sh: Add -x, --trace flags

This commit is contained in:
Anmol Sethi 2022-12-06 04:18:40 -08:00
parent 8010a65795
commit 70587d5832
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
4 changed files with 21 additions and 5 deletions

View file

@ -15,7 +15,7 @@ help() {
cat <<EOF cat <<EOF
usage: $arg0 [-d|--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix path] usage: $arg0 [-d|--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix path]
[--tala latest] [--force] [--uninstall] [--tala latest] [--force] [--uninstall] [-x|--trace]
install.sh automates the installation of D2 onto your system. It currently only supports install.sh automates the installation of D2 onto your system. It currently only supports
the installation of standalone releases from GitHub and via Homebrew on macOS. See the the installation of standalone releases from GitHub and via Homebrew on macOS. See the
@ -93,6 +93,9 @@ Flags:
package manager to uninstall instead. package manager to uninstall instead.
note: tala will also be uninstalled if installed. note: tala will also be uninstalled if installed.
-x, --trace:
Run script with set -x.
All downloaded archives are cached into ~/.cache/d2/release. use \$XDG_CACHE_HOME to change All downloaded archives are cached into ~/.cache/d2/release. use \$XDG_CACHE_HOME to change
path of the cached assets. Release archives are unarchived into \$PREFIX/lib/d2/d2-<VERSION> path of the cached assets. Release archives are unarchived into \$PREFIX/lib/d2/d2-<VERSION>
@ -147,6 +150,11 @@ main() {
flag_noarg && shift "$FLAGSHIFT" flag_noarg && shift "$FLAGSHIFT"
UNINSTALL=1 UNINSTALL=1
;; ;;
x|trace)
flag_noarg && shift "$FLAGSHIFT"
set -x
export TRACE=1
;;
*) *)
flag_errusage "unrecognized flag $FLAGRAW" flag_errusage "unrecognized flag $FLAGRAW"
;; ;;

View file

@ -84,7 +84,7 @@ if [ "${LIB_LOG-}" ]; then
fi fi
LIB_LOG=1 LIB_LOG=1
if [ -n "${DEBUG-}" ]; then if [ -n "${TRACE-}" ]; then
set -x set -x
fi fi

2
ci/sub

@ -1 +1 @@
Subproject commit 4beb5c09e5e3380641ee7e3b0c1d4f6358cca544 Subproject commit 4c26167bafbb6b4d038004c7e7666b2533a882d3

View file

@ -89,7 +89,7 @@ if [ "${LIB_LOG-}" ]; then
fi fi
LIB_LOG=1 LIB_LOG=1
if [ -n "${DEBUG-}" ]; then if [ -n "${TRACE-}" ]; then
set -x set -x
fi fi
@ -597,7 +597,7 @@ help() {
cat <<EOF cat <<EOF
usage: $arg0 [-d|--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix path] usage: $arg0 [-d|--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix path]
[--tala latest] [--force] [--uninstall] [--tala latest] [--force] [--uninstall] [-x|--trace]
install.sh automates the installation of D2 onto your system. It currently only supports install.sh automates the installation of D2 onto your system. It currently only supports
the installation of standalone releases from GitHub and via Homebrew on macOS. See the the installation of standalone releases from GitHub and via Homebrew on macOS. See the
@ -675,6 +675,9 @@ Flags:
package manager to uninstall instead. package manager to uninstall instead.
note: tala will also be uninstalled if installed. note: tala will also be uninstalled if installed.
-x, --trace:
Run script with set -x.
All downloaded archives are cached into ~/.cache/d2/release. use \$XDG_CACHE_HOME to change All downloaded archives are cached into ~/.cache/d2/release. use \$XDG_CACHE_HOME to change
path of the cached assets. Release archives are unarchived into \$PREFIX/lib/d2/d2-<VERSION> path of the cached assets. Release archives are unarchived into \$PREFIX/lib/d2/d2-<VERSION>
@ -729,6 +732,11 @@ main() {
flag_noarg && shift "$FLAGSHIFT" flag_noarg && shift "$FLAGSHIFT"
UNINSTALL=1 UNINSTALL=1
;; ;;
x|trace)
flag_noarg && shift "$FLAGSHIFT"
set -x
export TRACE=1
;;
*) *)
flag_errusage "unrecognized flag $FLAGRAW" flag_errusage "unrecognized flag $FLAGRAW"
;; ;;