@@ -14,7 +14,6 @@ msg_label=""
1414label_space=" 7"
1515adjust_chr=" "
1616customized_label=false
17- customized_label_color=false
1817nolabel=false
1918noappname=false
2019noadjust=false
@@ -41,23 +40,17 @@ _help() {
4140 echo " -x | --bash-debug Enables output bash debugging"
4241 echo " -h | --help This help message"
4342 echo
44- echo " --labelcolor Specify the color of label"
43+ # echo " --labelcolor Specify the color of label"
4544 echo " --nolabel Do not output label"
4645 echo " --noappname Do not output app name"
4746 echo " --noadjust Do not adjust the width of the label"
4847}
4948
5049
51- # Message functions
52- msg_error () {
53- " ${script_path} /tools/msg.sh" -a " msg.sh" error " ${1} "
54- }
55-
56-
5750# Parse options
5851ARGUMENT=" ${@ } "
5952_opt_short=" a:c:l:no:s:xh-:"
60- _opt_long=" appname:,chr:,label:,nocolor,option:,space:,bash-debug,help,labelcolor:, nolabel,noappname,noadjust"
53+ _opt_long=" appname:,chr:,label:,nocolor,option:,space:,bash-debug,help,nolabel,noappname,noadjust"
6154OPT=$( getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT} )
6255[[ ${?} != 0 ]] && exit 1
6356
@@ -113,40 +106,6 @@ while true; do
113106 noadjust=true
114107 shift 1
115108 ;;
116- --labelcolor)
117- customized_label_color=true
118- case ${2} in
119- " black" )
120- labelcolor=" 30"
121- ;;
122- " red" )
123- labelcolor=" 31"
124- ;;
125- " green" )
126- labelcolor=" 32"
127- ;;
128- " yellow" )
129- labelcolor=" 33"
130- ;;
131- " blue" )
132- labelcolor=" 34"
133- ;;
134- " magenta" )
135- labelcolor=" 35"
136- ;;
137- " cyan" )
138- labelcolor=" 36"
139- ;;
140- " white" )
141- labelcolor=" 37"
142- ;;
143- * )
144- msg_error " The wrong color."
145- exit 1
146- ;;
147- esac
148- shift 2
149- ;;
150109 --)
151110 shift
152111 break
@@ -195,38 +154,38 @@ shift $((OPTIND - 1))
195154case ${1} in
196155 " info" )
197156 msg_type=" type"
157+ textcolor=" 32"
198158 output=" stdout"
199- [[ " ${customized_label_color} " = false ]] && labelcolor=" 32"
200- [[ " ${customized_label} " = false ]] && msg_label=" Info"
159+ [[ " ${customized_label} " = false ]] && msg_label=" Info"
201160 shift 1
202161 ;;
203162 " warn" )
204163 msg_type=" warn"
164+ textcolor=" 33"
205165 output=" stdout"
206- [[ " ${customized_label_color} " = false ]] && labelcolor=" 33"
207- [[ " ${customized_label} " = false ]] && msg_label=" Warning"
166+ [[ " ${customized_label} " = false ]] && msg_label=" Warning"
208167 shift 1
209168 ;;
210169 " debug" )
211170 msg_type=" debug"
171+ textcolor=" 35"
212172 output=" stdout"
213- [[ " ${customized_label_color} " = false ]] && labelcolor=" 35"
214- [[ " ${customized_label} " = false ]] && msg_label=" Debug"
173+ [[ " ${customized_label} " = false ]] && msg_label=" Debug"
215174 shift 1
216175 ;;
217176 " error" )
218177 msg_type=" error"
178+ textcolor=" 31"
219179 output=" stderr"
220- [[ " ${customized_label_color} " = false ]] && labelcolor=" 31"
221- [[ " ${customized_label} " = false ]] && msg_label=" Error"
180+ [[ " ${customized_label} " = false ]] && msg_label=" Error"
222181 shift 1
223182 ;;
224183 " " )
225- msg_error " Please specify the message type"
184+ " ${script_path} /tools/msg.sh " -a " msg.sh " error " Please specify the message type"
226185 exit 1
227186 ;;
228187 * )
229- msg_error " Unknown message type"
188+ " ${script_path} /tools/msg.sh " -a " msg.sh " error " Unknown message type"
230189 exit 1
231190 ;;
232191esac
@@ -242,7 +201,7 @@ echo_type() {
242201 done
243202 fi
244203 if [[ " ${nocolor} " = false ]]; then
245- echo -ne " \e[$( [[ -v backcolor ]] && echo -n " ${backcolor} " ; [[ -v labelcolor ]] && echo -n " ;${labelcolor } " ; [[ -v decotypes ]] && echo -n " ;${decotypes} " ) m${msg_label} \e[m "
204+ echo -ne " \e[$( [[ -v backcolor ]] && echo -n " ${backcolor} " ; [[ -v textcolor ]] && echo -n " ;${textcolor } " ; [[ -v decotypes ]] && echo -n " ;${decotypes} " ) m${msg_label} \e[m "
246205 else
247206 echo -ne " ${msg_label} "
248207 fi
0 commit comments