Skip to content

Commit 07e9b7b

Browse files
committed
[update] : Use msg.sh to output message (keyring.sh)
1 parent af9e939 commit 07e9b7b

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tools/keyring.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,42 +80,40 @@ echo_color() {
8080
OPTIND=${OPTIND_bak}
8181
}
8282

83-
8483
# Show an INFO message
8584
# $1: message string
8685
msg_info() {
87-
local _msg="${1}"
88-
echo "$( echo_color -t '36' '[keyring.sh]') $( echo_color -t '32' 'Info') ${_msg}"
86+
local _msg_opts="-a keyring.sh"
87+
"${script_path}/tools/msg.sh" ${_msg_opts} info "${@}"
8988
}
9089

91-
9290
# Show an Warning message
9391
# $1: message string
9492
msg_warn() {
95-
local _msg="${1}"
96-
echo "$( echo_color -t '36' '[keyring.sh]') $( echo_color -t '33' 'Warning') ${_msg}" >&2
93+
local _msg_opts="-a keyring.sh"
94+
"${script_path}/tools/msg.sh" ${_msg_opts} warn "${@}"
9795
}
9896

99-
10097
# Show an debug message
10198
# $1: message string
10299
msg_debug() {
103-
local _msg="${1}"
104-
if [[ ${debug} = true ]]; then
105-
echo "$( echo_color -t '36' '[keyring.sh]') $( echo_color -t '35' 'Debug') ${_msg}"
100+
if [[ "${debug}" = true ]]; then
101+
local _msg_opts="-a keyring.sh"
102+
"${script_path}/tools/msg.sh" ${_msg_opts} info "${@}"
106103
fi
107104
}
108105

109-
110106
# Show an ERROR message then exit with status
111107
# $1: message string
112108
# $2: exit code number (with 0 does not exit)
113109
msg_error() {
114-
local _msg="${1}"
115-
echo "$( echo_color -t '36' '[keyring.sh]') $( echo_color -t '31' 'Error') ${_msg}" >&2
110+
local _msg_opts="-a keyring.sh"
111+
"${script_path}/tools/msg.sh" ${_msg_opts} error "${1}"
112+
if [[ -n "${2:-}" ]]; then
113+
exit ${2}
114+
fi
116115
}
117116

118-
119117
# Usage: getclm <number>
120118
# 標準入力から値を受けとり、引数で指定された列を抽出します。
121119
getclm() {

0 commit comments

Comments
 (0)