mirror of
https://github.com/gaschz/dotfiles.git
synced 2025-03-01 14:22:33 +01:00
31 lines
810 B
Bash
Executable File
31 lines
810 B
Bash
Executable File
#!/bin/sh
|
|
|
|
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|
##
|
|
## SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
set -eu
|
|
|
|
if command -v delta >/dev/null; then
|
|
exec delta "$@"
|
|
else
|
|
: "${DIFF_HIGHLIGHT_SOURCE:=/usr/share/doc/git/contrib/diff-highlight}"
|
|
: "${DIFF_HIGHLIGHT_EXEC:=/usr/share/git-core/contrib/diff-highlight}"
|
|
|
|
## Debian.
|
|
if command -v perl &&
|
|
test -f "${DIFF_HIGHLIGHT_SOURCE}/DiffHighlight.pm" &&
|
|
test -f "${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl"
|
|
then
|
|
exec perl -I "${DIFF_HIGHLIGHT_SOURCE}" -MDiffHighlight -- \
|
|
"${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl" | less -RS
|
|
|
|
## Fedora.
|
|
elif command -v perl && test -f "${DIFF_HIGHLIGHT_EXEC}"
|
|
then
|
|
exec "${DIFF_HIGHLIGHT_EXEC}" | less -RS
|
|
fi
|
|
|
|
exec less -RS "$@"
|
|
fi
|