message.sh: add modifications from output_format.sh

In the spirit of making libmakepkg more useful as a library, and,
critically, *using* that library for additional pacman scripts, we
should include all of output_format.sh and term_colors.sh directly in
libmakepkg and hopefully stop having to embed additional copies in e.g.
repo-add via m4 macros.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-06-28 13:19:42 -04:00 committed by Allan McRae
parent 882e707e40
commit 3561c872ca

View file

@ -44,20 +44,28 @@ colorize() {
} }
plain() { plain() {
(( QUIET )) && return
local mesg=$1; shift local mesg=$1; shift
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
} }
msg() { msg() {
(( QUIET )) && return
local mesg=$1; shift local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
} }
msg2() { msg2() {
(( QUIET )) && return
local mesg=$1; shift local mesg=$1; shift
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
} }
ask() {
local mesg=$1; shift
printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@"
}
warning() { warning() {
local mesg=$1; shift local mesg=$1; shift
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2