Skip to content

Commit e064c17

Browse files
bebarinogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3ddd170 commit e064c17

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

git-sh-setup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ die() {
4444
exit 1
4545
}
4646
47+
GIT_QUIET=
48+
49+
say () {
50+
if test -z "$GIT_QUIET"
51+
then
52+
printf '%s\n' "$*"
53+
fi
54+
}
55+
4756
if test -n "$OPTIONS_SPEC"; then
4857
usage() {
4958
"$0" -h

0 commit comments

Comments
 (0)