File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -246,8 +246,15 @@ printf -v _OLD_LINE_FMT "%b" $'\033[1;7;31m-'"$ESC ${RED}%L${ESC}"
246246printf -v _NEW_LINE_FMT " %b" $' \033 [1;7;32m+' " $ESC ${GREEN} %L${ESC} "
247247
248248_diff () {
249+ # macOS Ventura doesn't ship with GNU diff. Print similar output except
250+ # without +/- markers or dimming
251+ if diff --version | grep -q " Apple diff" ; then
252+ printf -v CHANGED_GROUP_FORMAT " %b" " ${GREEN} %>${RED} %<${ESC} "
253+ diff --changed-group-format=" $CHANGED_GROUP_FORMAT " " $@ "
254+ else
249255 # simple colorized diff comatible w/ pre `--color` versions
250- diff --unchanged-group-format=" $_UNCHANGED_GRP_FMT " --old-line-format=" $_OLD_LINE_FMT " --new-line-format=" $_NEW_LINE_FMT " --unchanged-line-format=" %L" " $@ "
256+ diff --unchanged-group-format=" $_UNCHANGED_GRP_FMT " --old-line-format=" $_OLD_LINE_FMT " --new-line-format=" $_NEW_LINE_FMT " --unchanged-line-format=" %L" " $@ "
257+ fi
251258}
252259
253260confirm_rm () {
You can’t perform that action at this time.
0 commit comments