@@ -25,96 +25,66 @@ _help() {
2525 echo " Display a message with a colored app name and message type label"
2626 echo
2727 echo " General type:"
28- echo " info General message"
29- echo " warn Warning message"
30- echo " error Error message"
31- echo " debug Debug message"
28+ echo " info General message"
29+ echo " warn Warning message"
30+ echo " error Error message"
31+ echo " debug Debug message"
3232 echo
3333 echo " General options:"
34- echo " -a | --appname [name] Specify the app name"
35- echo " -c | --chr [character] Specify the character to adjust the label"
36- echo " -l | --label [label] Specify the label"
37- echo " -n | --nocolor No output colored output"
38- echo " -o | --option [option] Specify echo options"
39- echo " -s | --space [number] Specifies the label space"
40- echo " -x | --bash-debug Enables output bash debugging"
41- echo " -h | --help This help message"
34+ echo " -a [name] Specify the app name"
35+ echo " -c [character] Specify the character to adjust the label"
36+ echo " -l [label] Specify the label. "
37+ echo " -n | --nocolor No output colored output"
38+ echo " -o [option] Specify echo options"
39+ echo " -s [number] Specifies the label space. "
40+ echo " -x | --bash-debug Enables output bash debugging"
41+ echo " -h | --help This help message"
4242 echo
43- # echo " --labelcolor Specify the color of label"
44- echo " --nolabel Do not output label"
45- echo " --noappname Do not output app name"
46- echo " --noadjust Do not adjust the width of the label"
43+ echo " --nolabel Do not output label"
44+ echo " --noappname Do not output app name"
45+ echo " --noadjust Do not adjust the width of the label"
4746}
4847
4948
50- # Parse options
51- ARGUMENT=" ${@ } "
52- _opt_short=" a:c:l:no:s:xh-:"
53- _opt_long=" appname:,chr:,label:,nocolor,option:,space:,bash-debug,help,nolabel,noappname,noadjust"
54- OPT=$( getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT} )
55- [[ ${?} != 0 ]] && exit 1
56-
57- eval set -- " ${OPT} "
58- unset OPT _opt_short _opt_long
59-
60- while true ; do
61- case ${1} in
62- -a | --appname)
63- appname=" ${2} "
64- shift 2
65- ;;
66- -c | --chr)
67- adjust_chr=" ${2} "
68- shift 2
69- ;;
70- -l | --label)
49+ while getopts " a:c:l:no:s:xh-:" arg; do
50+ case ${arg} in
51+ a) appname=" ${OPTARG} " ;;
52+ c) adjust_chr=" ${OPTARG} " ;;
53+ l)
7154 customized_label=true
72- msg_label=" ${2} "
73- shift 2
74- ;;
75- -n | --nocolor)
76- nocolor=true
77- shift 1
78- ;;
79- -o | --option)
80- echo_opts=" ${2} "
81- shift 2
82- ;;
83- -s | --spade)
84- label_space=" ${2} "
85- shift 2
55+ msg_label=" ${OPTARG} "
8656 ;;
87- -x | --bash-debug)
57+ n) nocolor=true ;;
58+ o) echo_opts=" ${OPTARG} " ;;
59+ s) label_space=" ${OPTARG} " ;;
60+ x)
8861 bash_debug=true
89- shift 1
9062 set -xv
9163 ;;
92- -h | --help )
64+ h )
9365 _help
9466 shift 1
9567 exit 0
9668 ;;
97- --nolabel)
98- nolabel=true
99- shift 1
100- ;;
101- --noappname)
102- noappname=true
103- shift 1
104- ;;
105- --noadjust)
106- noadjust=true
107- shift 1
108- ;;
109- --)
110- shift
111- break
112- ;;
113- * )
114- _help
115- shift 1
116- exit 1
117- ;;
69+ -)
70+ case " ${OPTARG} " in
71+ " nocolor" ) nocolor=true ;;
72+ " bash-debug" )
73+ bash_debug=true
74+ set -xv
75+ ;;
76+ " help" )
77+ _help
78+ exit 0
79+ ;;
80+ " nolabel" ) nolabel=true ;;
81+ " noappname" ) noappname=true ;;
82+ " noadjust" ) noadjust=true ;;
83+ * )
84+ _help
85+ exit 1
86+ ;;
87+ esac
11888 esac
11989done
12090
0 commit comments