[pacman-dev] [PATCH 2/3] message.sh: add modifications from output_format.sh
Eli Schwartz
eschwartz at archlinux.org
Thu Jun 28 17:19:42 UTC 2018
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 at archlinux.org>
---
This has been sitting in my queue for a bit, but I cleaned it up with
the preceding and following patches. It's a double win, because we can
delete duplicated code from our own scripts as well as rely on this for
pacman-contrib. At least now that we consistently use stdout in both.
scripts/libmakepkg/util/message.sh.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/libmakepkg/util/message.sh.in b/scripts/libmakepkg/util/message.sh.in
index 36790c26..097da2b2 100644
--- a/scripts/libmakepkg/util/message.sh.in
+++ b/scripts/libmakepkg/util/message.sh.in
@@ -44,20 +44,28 @@ colorize() {
}
plain() {
+ (( QUIET )) && return
local mesg=$1; shift
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
}
msg() {
+ (( QUIET )) && return
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
}
msg2() {
+ (( QUIET )) && return
local mesg=$1; shift
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
}
+ask() {
+ local mesg=$1; shift
+ printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@"
+}
+
warning() {
local mesg=$1; shift
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
--
2.18.0
More information about the pacman-dev
mailing list