From: hayao Date: Sun, 4 Oct 2020 02:11:07 +0000 (+0900) Subject: [update] : Add -n in message output X-Git-Tag: rc3-alpha1~156 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d2cbcafc133b9ce732f05af93171f36d3b21225b;p=alterlinux%2Falterlinux.git [update] : Add -n in message output --- diff --git a/build.sh b/build.sh index 9cbdc680..3afa1626 100755 --- a/build.sh +++ b/build.sh @@ -84,10 +84,10 @@ msg_debug() { # $2: exit code number (with 0 does not exit) msg_error() { local _msg_opts="-a build.sh" - if [[ "${1}" = "-n" ]]; then - _msg_opts="${_msg_opts} -o -n" - shift 1 - fi + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x" [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n" "${script_path}/tools/msg.sh" ${_msg_opts} error "${1}" diff --git a/tools/fullbuild.sh b/tools/fullbuild.sh index ee4c3a8d..6e6c3fdc 100755 --- a/tools/fullbuild.sh +++ b/tools/fullbuild.sh @@ -30,29 +30,41 @@ all_channel=false # Show an INFO message # $1: message string msg_info() { - local _msg_opts="-a fullbuild.sh" + local _msg_opts="-a build.sh" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x" [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n" - "${script_path}/tools/msg.sh" ${_msg_opts} info "${@}" + "${script_path}/tools/msg.sh" ${_msg_opts} info "${1}" } # Show an Warning message # $1: message string msg_warn() { - local _msg_opts="-a fullbuild.sh" + local _msg_opts="-a build.sh" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x" [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n" - "${script_path}/tools/msg.sh" ${_msg_opts} warn "${@}" + "${script_path}/tools/msg.sh" ${_msg_opts} warn "${1}" } # Show an debug message # $1: message string msg_debug() { if [[ "${debug}" = true ]]; then - local _msg_opts="-a fullbuild.sh" + local _msg_opts="-a build.sh" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x" [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n" - "${script_path}/tools/msg.sh" ${_msg_opts} info "${@}" + "${script_path}/tools/msg.sh" ${_msg_opts} info "${1}" fi } @@ -60,7 +72,11 @@ msg_debug() { # $1: message string # $2: exit code number (with 0 does not exit) msg_error() { - local _msg_opts="-a fullbuild.sh" + local _msg_opts="-a build.sh" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x" [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n" "${script_path}/tools/msg.sh" ${_msg_opts} error "${1}" @@ -70,7 +86,6 @@ msg_error() { } - trap_exit() { local status=${?} echo diff --git a/tools/keyring.sh b/tools/keyring.sh index b604ac14..5a95850f 100755 --- a/tools/keyring.sh +++ b/tools/keyring.sh @@ -84,14 +84,22 @@ echo_color() { # $1: message string msg_info() { local _msg_opts="-a keyring.sh" - "${script_path}/tools/msg.sh" ${_msg_opts} info "${@}" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi + "${script_path}/tools/msg.sh" ${_msg_opts} info "${1}" } # Show an Warning message # $1: message string msg_warn() { local _msg_opts="-a keyring.sh" - "${script_path}/tools/msg.sh" ${_msg_opts} warn "${@}" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi + "${script_path}/tools/msg.sh" ${_msg_opts} warn "${1}" } # Show an debug message @@ -99,7 +107,11 @@ msg_warn() { msg_debug() { if [[ "${debug}" = true ]]; then local _msg_opts="-a keyring.sh" - "${script_path}/tools/msg.sh" ${_msg_opts} info "${@}" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi + "${script_path}/tools/msg.sh" ${_msg_opts} info "${1}" fi } @@ -108,6 +120,10 @@ msg_debug() { # $2: exit code number (with 0 does not exit) msg_error() { local _msg_opts="-a keyring.sh" + if [[ "${1}" = "-n" ]]; then + _msg_opts="${_msg_opts} -o -n" + shift 1 + fi "${script_path}/tools/msg.sh" ${_msg_opts} error "${1}" if [[ -n "${2:-}" ]]; then exit ${2}