git-sh-setup: introduce say() for quiet options
Scripts should use say() when they want to output non-error messages. This function helps future script writers easily implement a quiet option by setting GIT_QUIET to enable suppression of non-error messages. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stephen Boyd committed
Jun 16, 2009 at 15:32 UTC
e064c170b4abe21f50658f2ec3b07e4ec7520767
1 file changed
+9
git-sh-setup.sh
+9
@@ -44,6 +44,15 @@ die() {
44
exit 1
45
}
46
47
+GIT_QUIET=
48
+
49
+say () {
50
+ if test -z "$GIT_QUIET"
51
+ then
52
+ printf '%s\n' "$*"
53
+ fi
54
+}
55
+
56
if test -n "$OPTIONS_SPEC"; then
57
usage() {
58
"$0" -h