Skip to content

Commit b29a5f3

Browse files
committed
add colorized output
1 parent 0851fd3 commit b29a5f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

share/github-backup-utils/ghe-backup-config

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ if [ -n "$GHE_VERBOSE" ]; then
193193
fi
194194
calling_script_name="$(caller | sed 's:.*/::')"
195195
date_format=$(date -u "+%FT%TZ")
196-
exec 3> >(awk -v '{ print d" INFO ", c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG")
196+
if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then
197+
exec 3> >(awk -v '{ print d" INFO ", c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" >>"$GHE_VERBOSE_LOG")
198+
else
199+
display_info=" ${GREEN}INFO${NC} "
200+
exec 3> >(awk -v '{ print d, i, c":", $0; fflush(); }' c="$calling_script_name" d="$date_format" i="$display_info" >>"$GHE_VERBOSE_LOG")
201+
fi
197202
fi
198203
else
199204
exec 3>&1

0 commit comments

Comments
 (0)