Skip to content

Commit 4fb357f

Browse files
committed
[fix] : Supported --message
1 parent c57fab0 commit 4fb357f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tools/msg.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ _help() {
3535
echo " -a | --appname [name] Specify the app name"
3636
echo " -c | --chr [character] Specify the character to adjust the label"
3737
echo " -l | --label [label] Specify the label"
38+
echo " -m | --message [message] Specify the message."
39+
echo " Use only if you have problems interpreting arguments"
3840
echo " -n | --nocolor No output colored output"
3941
echo " -o | --option [option] Specify echo options"
4042
echo " -s | --space [number] Specifies the label space"
@@ -56,8 +58,8 @@ msg_error() {
5658

5759
# Parse options
5860
ARGUMENT="${@}"
59-
_opt_short="a:c:l:no:s:xh-:"
60-
_opt_long="appname:,chr:,label:,nocolor,option:,space:,bash-debug,help,labelcolor:,nolabel,noappname,noadjust"
61+
_opt_short="a:c:l:m:no:s:xh-:"
62+
_opt_long="appname:,chr:,label:,nocolor,message:,option:,space:,bash-debug,help,labelcolor:,nolabel,noappname,noadjust"
6163
OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT})
6264
[[ ${?} != 0 ]] && exit 1
6365

@@ -79,6 +81,10 @@ while true; do
7981
msg_label="${2}"
8082
shift 2
8183
;;
84+
-m | --message)
85+
message="${2}"
86+
shift 2
87+
;;
8288
-n | --nocolor)
8389
nocolor=true
8490
shift 1
@@ -232,7 +238,9 @@ case ${1} in
232238
esac
233239

234240
word_count="${#msg_label}"
235-
message="${@}"
241+
if [[ -z "${message}" ]]; then
242+
message="${@}"
243+
fi
236244

237245
echo_type() {
238246
if [[ "${nolabel}" = false ]]; then

0 commit comments

Comments
 (0)