src/here-pull-overlays: stylize; add header

Signed-off-by: Maciej Barć <xgqt@protonmail.com>
This commit is contained in:
Maciej Barć 2020-12-22 01:48:17 +01:00
parent b36108245a
commit 98fa5b7665
No known key found for this signature in database
GPG Key ID: 031C9FE65BED714A
1 changed files with 14 additions and 11 deletions

View File

@ -1,17 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Original author: XGQT
# Licensed under the ISC License
# Copyright (c) 2020, src_prepare group
set -o pipefail set -o pipefail
trap 'exit 1' INT trap 'exit 128' INT
export PATH export PATH
emsg() emsg() {
{
echo "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)" echo "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)"
} }
edie()
{ edie() {
if [ -z "${1}" ] if [ -z "${1}" ]
then then
emsg "$(tput setaf 1)Failed: last command" emsg "$(tput setaf 1)Failed: last command"
@ -20,17 +24,16 @@ edie()
fi fi
exit 1 exit 1
} }
erun() erun() {
{
emsg "Running: ${*}" emsg "Running: ${*}"
"${@}" | busybox ts '>>> %H:%M:%S' || edie "${@}" "${@}" | busybox ts '>>> %H:%M:%S' || edie "${@}"
} }
einto()
{ einto() {
pushd "${1}" >/dev/null || edie "Could not open ${1}" pushd "${1}" >/dev/null || edie "Could not open ${1}"
} }
eback()
{ eback() {
popd >/dev/null || edie popd >/dev/null || edie
} }