[PATCHv3 2/4] git-sh-setup: introduce say() for quiet options
- From
Stephen Boyd <bebarino@gmail.com>
- Date
- Jun 16, 2009, 02:05 UTC
- Message-ID
- <1245117905-19351-3-git-send-email-bebarino@gmail.com>
- In-Reply-To
- <1245117905-19351-2-git-send-email-bebarino@gmail.com>
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> --- git-sh-setup.sh | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 80acb7d..33513d2 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -44,6 +44,16 @@ die() { exit 1 } +GIT_QUIET= + +say () { + if test -z "$GIT_QUIET" + then + printf "%s" "$*" + echo + fi +} + if test -n "$OPTIONS_SPEC"; then usage() { "$0" -h
-- 1.6.3.2.306.g4f4fa