Skip to content

Commit bffe590

Browse files
committed
[update] : Supported long options
1 parent 3b2b5d7 commit bffe590

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

tools/msg.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ _help() {
2626
echo "Display a message with a colored app name and message type label"
2727
echo
2828
echo " General type:"
29-
echo " info General message"
30-
echo " warn Warning message"
31-
echo " error Error message"
32-
echo " debug Debug message"
29+
echo " info General message"
30+
echo " warn Warning message"
31+
echo " error Error message"
32+
echo " debug Debug message"
3333
echo
3434
echo " General options:"
35-
echo " -a [name] Specify the app name"
36-
echo " -c [character] Specify the character to adjust the label"
37-
echo " -l [label] Specify the label."
38-
echo " -n | --nocolor No output colored output"
39-
echo " -o [option] Specify echo options"
40-
echo " -r [color] Specify the color of label"
41-
echo " -s [number] Specifies the label space."
42-
echo " -x | --bash-debug Enables output bash debugging"
43-
echo " -h | --help This help message"
35+
echo " -a | --appname [name] Specify the app name"
36+
echo " -c | --adjust-chr [character] Specify the character to adjust the label"
37+
echo " -l | --label [label] Specify the label."
38+
echo " -n | --nocolor No output colored output"
39+
echo " -o | --echo-opts [option] Specify echo options"
40+
echo " -r | --label-color [color] Specify the color of label"
41+
echo " -s | --label-space [number] Specifies the label space."
42+
echo " -x | --bash-debug Enables output bash debugging"
43+
echo " -h | --help This help message"
4444
echo
45-
echo " --nolabel Do not output label"
46-
echo " --noappname Do not output app name"
47-
echo " --noadjust Do not adjust the width of the label"
45+
echo " --nolabel Do not output label"
46+
echo " --noappname Do not output app name"
47+
echo " --noadjust Do not adjust the width of the label"
4848
}
4949

5050
# Message functions
@@ -56,7 +56,7 @@ msg_error() {
5656
# Parse options
5757
ARGUMENT="${*}"
5858
_opt_short="a:c:l:no:r:s:xh"
59-
_opt_long="nocolor,bash-debug,help,nolabel,noappname,noadjust"
59+
_opt_long="nocolor,bash-debug,help,nolabel,noappname,noadjust,appname:,adjust-chr:,label:,echo-opts:,label-color:,label-space:"
6060
OPT=$(getopt -uo ${_opt_short} -l ${_opt_long} -- "${ARGUMENT}")
6161
[[ ${?} != 0 ]] && exit 1
6262

@@ -65,28 +65,28 @@ unset OPT _opt_short _opt_long
6565

6666
while true; do
6767
case "${1}" in
68-
-a)
68+
-a | --appname)
6969
appname="${2}"
7070
shift 2
7171
;;
72-
-c)
72+
-c | --adjust-chr)
7373
adjust_chr="${2}"
7474
shift 2
7575
;;
76-
-l)
76+
-l | --label)
7777
customized_label=true
7878
msg_label="${2}"
7979
shift 2
8080
;;
81-
-n)
81+
-n | --nocolor)
8282
nocolor=true
8383
shift 1
8484
;;
85-
-o)
85+
-o | --echo-opts)
8686
echo_opts="${2}"
8787
shift 2
8888
;;
89-
-r)
89+
-r | --label-color)
9090
customized_label_color=true
9191
case "${2}" in
9292
"black")
@@ -120,7 +120,7 @@ while true; do
120120
esac
121121
shift 2
122122
;;
123-
-s)
123+
-s | --label-space)
124124
label_space="${2}"
125125
shift 2
126126
;;

0 commit comments

Comments
 (0)