config/functions: build_msg avoid outputting single space for 0 indent

This commit is contained in:
MilhouseVH 2018-11-21 12:32:05 +00:00 committed by Ian Leonard
parent d97b2b3793
commit 87c0981b28

View File

@ -107,10 +107,14 @@ print_color() {
# print build progress messages
# param1: message color, p2: label, p3: text, p4: indent (optional)
build_msg() {
local spaces
[ -n "${BUILD_INDENT}" ] && spaces="$(printf "%${BUILD_INDENT}c" " ")" || spaces=""
if [ -n "${3}" ]; then
printf "%${BUILD_INDENT}c$(print_color "${1}" "${2}") ${3}\n" ' '>&${SILENT_OUT}
echo -e "${spaces}$(print_color "${1}" "${2}") ${3}" >&${SILENT_OUT}
else
printf "%${BUILD_INDENT}c$(print_color "${1}" "${2}")\n" ' '>&${SILENT_OUT}
echo -e "${spaces}$(print_color "${1}" "${2}")" >&${SILENT_OUT}
fi
# pad left space to create "indent" effect