OSDN Git Service

[update] : Add -n in message output
authorhayao <shun819.mail@gmail.com>
Sun, 4 Oct 2020 02:11:07 +0000 (11:11 +0900)
committerhayao <shun819.mail@gmail.com>
Sun, 4 Oct 2020 02:11:07 +0000 (11:11 +0900)
build.sh
tools/fullbuild.sh
tools/keyring.sh

index 9cbdc68..3afa162 100755 (executable)
--- 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}"
index ee4c3a8..6e6c3fd 100755 (executable)
@@ -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
index b604ac1..5a95850 100755 (executable)
@@ -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}