@@ -25,54 +25,39 @@ all_channel=false
2525customized_work=false
2626noconfirm=false
2727
28- # Show an INFO message
29- # $1: message string
30- msg_info () {
31- local _msg_opts=" -a fullbuilid -s 5"
32- if [[ " ${1} " = " -n" ]]; then
33- _msg_opts=" ${_msg_opts} -o -n"
34- shift 1
35- fi
36- " ${script_path} /tools/msg.sh" ${_msg_opts} info " ${1} "
28+ # Message common function
29+ # msg_common [type] [-n] [string]
30+ msg_common (){
31+ local _msg_opts=(" -a" " fullbuild" " -s" " 5" ) _type=" ${1} "
32+ shift 1
33+ [[ " ${1} " = " -n" ]] && _msg_opts+=(" -o" " -n" ) && shift 1
34+ [[ " ${msgdebug} " = true ]] && _msg_opts+=(" -x" )
35+ [[ " ${nocolor} " = true ]] && _msg_opts+=(" -n" )
36+ _msg_opts+=(" ${_type} " " ${@ } " )
37+ " ${script_path} /tools/msg.sh" " ${_msg_opts[@]} "
3738}
3839
40+ # Show an INFO message
41+ # ${1}: message string
42+ msg_info () { msg_common info " ${@ } " ; }
43+
3944# Show an Warning message
40- # $1: message string
41- msg_warn () {
42- local _msg_opts=" -a fullbuilid -s 5"
43- if [[ " ${1} " = " -n" ]]; then
44- _msg_opts=" ${_msg_opts} -o -n"
45- shift 1
46- fi
47- " ${script_path} /tools/msg.sh" ${_msg_opts} warn " ${1} "
48- }
45+ # ${1}: message string
46+ msg_warn () { msg_common warn " ${@ } " ; }
4947
5048# Show an debug message
51- # $1: message string
52- msg_debug () {
53- if [[ " ${debug} " = true ]]; then
54- local _msg_opts=" -a fullbuilid -s 5"
55- if [[ " ${1} " = " -n" ]]; then
56- _msg_opts=" ${_msg_opts} -o -n"
57- shift 1
58- fi
59- " ${script_path} /tools/msg.sh" ${_msg_opts} debug " ${1} "
60- fi
49+ # ${1}: message string
50+ msg_debug () {
51+ [[ " ${debug} " = true ]] && msg_common debug " ${@ } "
52+ return 0
6153}
6254
6355# Show an ERROR message then exit with status
64- # $1 : message string
65- # $2 : exit code number (with 0 does not exit)
56+ # ${1} : message string
57+ # ${2} : exit code number (with 0 does not exit)
6658msg_error () {
67- local _msg_opts=" -a fullbuilid -s 5"
68- if [[ " ${1} " = " -n" ]]; then
69- _msg_opts=" ${_msg_opts} -o -n"
70- shift 1
71- fi
72- " ${script_path} /tools/msg.sh" ${_msg_opts} error " ${1} "
73- if [[ -n " ${2:- } " ]]; then
74- exit ${2}
75- fi
59+ msg_common error " ${1} "
60+ [[ -n " ${2:- } " ]] && exit " ${2} "
7661}
7762
7863
0 commit comments