summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-01 03:49:57 +0000
committerLuca Boccassi <bluca@debian.org>2020-03-05 21:04:23 +0000
commitcac44b28d5699c4e6733310b1f8b4968e09a2854 (patch)
treeb8e29b2f437c0508778d99fc54d51dae698f0bd1 /functions
parent450fb25fbd0fa35d7d0db7789344935caa04f355 (diff)
downloadvyos-live-build-cac44b28d5699c4e6733310b1f8b4968e09a2854.tar.gz
vyos-live-build-cac44b28d5699c4e6733310b1f8b4968e09a2854.zip
echo: tidy
Gbp-Dch: Ignore
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/echo.sh36
1 files changed, 14 insertions, 22 deletions
diff --git a/functions/echo.sh b/functions/echo.sh
index c11797a12..438cfe5d6 100755
--- a/functions/echo.sh
+++ b/functions/echo.sh
@@ -18,8 +18,7 @@ Echo ()
Echo_debug ()
{
- if [ "${_DEBUG}" = "true" ]
- then
+ if [ "${_DEBUG}" = "true" ]; then
STRING="${1}"
shift
@@ -32,14 +31,12 @@ Echo_error ()
STRING="${1}"
shift
- if [ "${_COLOR}" = "false" ]
- then
- printf "E:" >&2
- else
- printf "${RED}E${NO_COLOR}:" >&2
+ local PREFIX="${RED}E${NO_COLOR}"
+ if [ "${_COLOR}" = "false" ]; then
+ PREFIX="E"
fi
- printf " ${STRING}\n" "${@}" >&2
+ printf "${PREFIX}: ${STRING}\n" "${@}" >&2
}
Echo_message ()
@@ -49,21 +46,18 @@ Echo_message ()
STRING="${1}"
shift
- if [ "${_COLOR}" = "false" ]
- then
- printf "P:" >&1
- else
- printf "${WHITE}P${NO_COLOR}:" >&1
+ local PREFIX="${WHITE}P${NO_COLOR}"
+ if [ "${_COLOR}" = "false" ]; then
+ PREFIX="P"
fi
- printf " ${STRING}\n" "${@}" >&1
+ printf "${PREFIX}: ${STRING}\n" "${@}" >&1
fi
}
Echo_verbose ()
{
- if [ "${_VERBOSE}" = "true" ]
- then
+ if [ "${_VERBOSE}" = "true" ]; then
STRING="${1}"
shift
@@ -76,14 +70,12 @@ Echo_warning ()
STRING="${1}"
shift
- if [ "${_COLOR}" = "false" ]
- then
- printf "W:" >&2
- else
- printf "${YELLOW}W${NO_COLOR}:" >&2
+ local PREFIX="${YELLOW}W${NO_COLOR}"
+ if [ "${_COLOR}" = "false" ]; then
+ PREFIX="W"
fi
- printf " ${STRING}\n" "${@}" >&2
+ printf "${PREFIX}: ${STRING}\n" "${@}" >&2
}
Echo_file ()