From 89e0e89d8934850cf3a421034d8a21f15880d864 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 23 Nov 2021 09:07:02 +0000 Subject: [PATCH] feature(delta): automagically set delta to default git diff --- delta/README.md | 2 ++ delta/install.ps1 | 8 ++++++++ delta/install.sh | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/delta/README.md b/delta/README.md index c53acc3..f18b379 100644 --- a/delta/README.md +++ b/delta/README.md @@ -7,6 +7,8 @@ tagline: | To update or switch versions, run `webi delta` (or `@0.9.1`, `@0.9.0`, etc). +**Note**: You should install [git](./git) before installing `delta`. + ## Cheat Sheet > `delta` gives you GitHub-style diffs, with word-level diff coloring, right in diff --git a/delta/install.ps1 b/delta/install.ps1 index b27856d..ee1ffbf 100644 --- a/delta/install.ps1 +++ b/delta/install.ps1 @@ -48,6 +48,14 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null Move-Item -Path ".\delta-*\delta.exe" -Destination "$pkg_src_bin" + # set delta to be the default differ + git config --global page.diff delta + git config --global page.show delta + git config --global page.log delta + git config --global page.blame delta + git config --global page.reflog delta + + git config --global interactive.diffFilter 'delta --color-only' # Exit tmp popd } diff --git a/delta/install.sh b/delta/install.sh index 748143a..024d7eb 100644 --- a/delta/install.sh +++ b/delta/install.sh @@ -2,8 +2,10 @@ set -e set -u -function __init_delta() { +# shellcheck disable=SC2034 +# "'pkg_cmd_name' appears unused. Verify it or export it." +function __init_delta() { ################# # Install delta # @@ -22,10 +24,18 @@ function __init_delta() { # pkg_install must be defined by every package pkg_install() { # ~/.local/opt/delta-v0.99.9/bin - mkdir -p "$(dirname $pkg_src_cmd)" + mkdir -p "$(dirname "$pkg_src_cmd")" # mv ./delta-*/delta ~/.local/opt/delta-v0.99.9/bin/delta mv ./delta-*/delta "$pkg_src_cmd" + + git config --global page.diff delta + git config --global page.show delta + git config --global page.log delta + git config --global page.blame delta + git config --global page.reflog delta + + git config --global interactive.diffFilter 'delta --color-only' } # pkg_get_current_version is recommended, but not required -- 2.25.1