From 14cd04de96a90d5172b17b2747209324b5ece766 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sun, 2 Oct 2022 22:44:22 +0200 Subject: [PATCH] bin/dif: do not wiked-diff big files --- .local/bin/scripts/dif | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.local/bin/scripts/dif b/.local/bin/scripts/dif index 8d5a0eb..e8b03f2 100755 --- a/.local/bin/scripts/dif +++ b/.local/bin/scripts/dif @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash -ex # interactive diff with pagination and nice coloring # TODO diff sqlite repos with sqldiff mime="$(file --brief --mime "$1" "$2")" @@ -9,6 +9,9 @@ case "$mime" in --report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2") ;; (*sqlite*) sqldiff "$@" ;; -(*) wiked-diff "$@" ;; - # diff-color --report-identical-files "$@";; +(*) # Use wiked-diff only for text <10MB + if expr "$mime" : "text/" >/dev/null && test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)" + then wiked-diff "$@" + else diff-color --report-identical-files "$@" + fi;; esac | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen