install.sh: Improve dry run message and add short flag -d

This commit is contained in:
Anmol Sethi 2022-11-29 14:18:52 -08:00
parent 5de523b26a
commit ea876e051b
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
4 changed files with 25 additions and 15 deletions

View file

@ -14,7 +14,7 @@ help() {
fi
cat <<EOF
usage: $arg0 [--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix /usr/local]
usage: $arg0 [-d|--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix /usr/local]
[--tala latest] [--force] [--uninstall]
install.sh automates the installation of D2 onto your system. It currently only supports
@ -26,7 +26,7 @@ If you pass --edge, it will clone the source, build a release and install from i
Flags:
--dry-run
-d, --dry-run
Pass to have install.sh show the install method and flags that will be used to install
without executing them. Very useful to understand what changes it will make to your system.
@ -101,7 +101,7 @@ main() {
help
return 0
;;
dry-run)
d|dry-run)
flag_noarg && shift "$FLAGSHIFT"
DRY_RUN=1
;;
@ -188,12 +188,16 @@ main() {
if [ -n "${UNINSTALL-}" ]; then
uninstall
if [ -n "${DRY_RUN-}" ]; then
log "Rerun without --dry-run to execute printed commands and perform uninstall."
FGCOLOR=3 bigheader "***********
Rerun without --dry-run to execute printed commands and perform install.
***********"
fi
else
install
if [ -n "${DRY_RUN-}" ]; then
log "Rerun without --dry-run to execute printed commands and perform install."
FGCOLOR=3 bigheader "***********
Rerun without --dry-run to execute printed commands and perform install.
***********"
fi
fi
}

View file

@ -62,7 +62,7 @@ should_color() {
_COLOR=1
return 0
else
printf '$COLOR must be 0, 1, false or true but got %s' "$COLOR" >&2
printf '$COLOR must be 0, 1, false or true but got %s\n' "$COLOR" >&2
fi
fi
@ -219,8 +219,9 @@ header() {
}
bigheader() {
set -- "$(echo "$*" | sed "s/^/ * /")"
logp "/**
* $1
$*
**/"
}

2
ci/sub

@ -1 +1 @@
Subproject commit 765e3ddc7bbd669f3605f9f877bc6004c1b80735
Subproject commit 18ad1a2780f6e9119439a4b015de1ce0b875e0ba

View file

@ -68,7 +68,7 @@ should_color() {
_COLOR=1
return 0
else
printf '$COLOR must be 0, 1, false or true but got %s' "$COLOR" >&2
printf '$COLOR must be 0, 1, false or true but got %s\n' "$COLOR" >&2
fi
fi
@ -225,8 +225,9 @@ header() {
}
bigheader() {
set -- "$(echo "$*" | sed "s/^/ * /")"
logp "/**
* $1
$*
**/"
}
@ -478,7 +479,7 @@ help() {
fi
cat <<EOF
usage: $arg0 [--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix /usr/local]
usage: $arg0 [-d|--dry-run] [--version vX.X.X] [--edge] [--method detect] [--prefix /usr/local]
[--tala latest] [--force] [--uninstall]
install.sh automates the installation of D2 onto your system. It currently only supports
@ -490,7 +491,7 @@ If you pass --edge, it will clone the source, build a release and install from i
Flags:
--dry-run
-d, --dry-run
Pass to have install.sh show the install method and flags that will be used to install
without executing them. Very useful to understand what changes it will make to your system.
@ -565,7 +566,7 @@ main() {
help
return 0
;;
dry-run)
d|dry-run)
flag_noarg && shift "$FLAGSHIFT"
DRY_RUN=1
;;
@ -652,12 +653,16 @@ main() {
if [ -n "${UNINSTALL-}" ]; then
uninstall
if [ -n "${DRY_RUN-}" ]; then
log "Rerun without --dry-run to execute printed commands and perform uninstall."
FGCOLOR=3 bigheader "***********
Rerun without --dry-run to execute printed commands and perform install.
***********"
fi
else
install
if [ -n "${DRY_RUN-}" ]; then
log "Rerun without --dry-run to execute printed commands and perform install."
FGCOLOR=3 bigheader "***********
Rerun without --dry-run to execute printed commands and perform install.
***********"
fi
fi
}