Skip to content

Commit 65891e2

Browse files
committed
Only emit terminal codes to terminal
Check for presence of tput and for stdout being a terminal before emitting terminal control codes. Remove unnecessary dependence on `say`
1 parent 99d01d5 commit 65891e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-secrets

+2-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ install_hook() {
205205
echo "#!/usr/bin/env bash" > "${dest}"
206206
echo "git secrets --${cmd} -- \"\$@\"" >> "${dest}"
207207
chmod +x "${dest}"
208-
say "$(tput setaf 2)$(tput sgr 0) Installed ${hook} hook to ${dest}"
208+
[ -t 1 ] && which tput >/dev/null && echo -n "$(tput setaf 2)$(tput sgr 0) "
209+
echo "Installed ${hook} hook to ${dest}"
209210
}
210211

211212
install_all_hooks() {

0 commit comments

Comments
 (0)