From 25e98d5444af19df88137ef5f2031516d8f4996b Mon Sep 17 00:00:00 2001 From: hayao Date: Sat, 21 Nov 2020 09:13:43 +0900 Subject: [PATCH] [update] : Use msg.sh insted of echo_color --- build.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/build.sh b/build.sh index 75322ec..f0bbe0a 100755 --- a/build.sh +++ b/build.sh @@ -60,47 +60,41 @@ _msg_common() { _current_time="$(date +%s)" _time="$(("${_current_time}"-"${start_time}"))" - if [[ "${_time}" -ge 3600 ]]; then - echo "[$(date -d @${_time} +%H:%M.%S)]$("${script_path}/echo_color" -t 6 "[LFBS Core]")" - elif [[ "${_time}" -ge 60 ]]; then - echo "[00:$(date -d @${_time} +%M.%S)]$("${script_path}/echo_color" -t 6 "[LFBS Core]")" + #if [[ "${_time}" -ge 3600 ]]; then + if (( "${_time}" >= 3600 )); then + echo -n "[$(date -d @${_time} +%H:%M.%S)] " + #elif [[ "${_time}" -ge 60 ]]; then + elif (( "${_time}" >= 60 )); then + echo -n "[00:$(date -d @${_time} +%M.%S)] " else - echo "[00:00.$(date -d @${_time} +%S)] $("${script_path}/echo_color" -t 6 "[LFBS Core]")" + echo -n "[00:00.$(date -d @${_time} +%S)] " fi - else - "${script_path}/echo_color" -t 6 "[LFBS Core]" fi } # Show an INFO message # _msg_info _msg_info() { - local _msg - _msg="${@}" - echo "$(_msg_common) $("${script_path}/echo_color" -t 2 "Info:") ${_msg}" + _msg_common + "${script_path}/tools/msg.sh" -a "LFBS Core" -l "Info:" -s "6" info "${@}" } # Show an debug message # _msg_debug _msg_debug() { + _msg_common if [[ "${debug}" = true ]]; then - local _msg - _msg="${@}" - echo "$(_msg_common) $("${script_path}/echo_color" -t 3 "Debug:") ${_msg}" + "${script_path}/tools/msg.sh" -a "LFBS Core" -l "Debug:" -s "6" debug "${@}" fi } # Show an ERROR message then exit with status # _msg_error _msg_error() { - local _msg - local _error - _msg="${1}" - _error=${2} - echo "$(_msg_common) $("${script_path}/echo_color" -t 1 "Error:") ${_msg}" - - if [[ ! ${_error} = 0 ]]; then - exit ${_error} + _msg_common + "${script_path}/tools/msg.sh" -a "LFBS Core" -l "Error:" -s "6" error "${@}" + if [[ -n "${2:-}" ]]; then + exit ${2} fi } -- 2.11.0