From fc13dd362cd9a44794a89f12daef4b2f225de7c3 Mon Sep 17 00:00:00 2001 From: V <68829907+deviant@users.noreply.github.com> Date: Fri, 4 Sep 2020 18:43:09 +0200 Subject: [PATCH] Colourise diff(1) output, if supported (#7308) --- CHANGELOG.rst | 1 + share/functions/diff.fish | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 share/functions/diff.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a9e9353d8..f216137a0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -103,6 +103,7 @@ Interactive improvements revealed. - The output of ``time`` is now properly aligned in all cases (#6726). - The ``pwd`` command supports the long options ``--logical`` and ``--physical``, matching other implementations (#6787). +- ``diff`` will now colourise output, if supported (#7308). New or improved bindings diff --git a/share/functions/diff.fish b/share/functions/diff.fish new file mode 100644 index 000000000..e91335b09 --- /dev/null +++ b/share/functions/diff.fish @@ -0,0 +1,6 @@ +# Use colours in diff output, if supported +if command -vq diff; and command diff --color=auto /dev/null{,} >/dev/null 2>&1 + function diff + command diff --color=auto $argv + end +end