feature(delta): automagically set delta to default git diff
[webi-installers/.git] / delta / install.ps1
index 8679d09424bffd7fcc318cce9969ae038a7cbad5..ee1ffbf9d1701b3030f0775d5ac2b44555ce6dc7 100644 (file)
@@ -21,10 +21,8 @@ $pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
 # Fetch archive
 IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
 {
-    # TODO: arch detection
-    # useragent -A was causing download to fail at 1kb
     echo "Downloading delta from $Env:WEBI_PKG_URL to $pkg_download"
-    & curl.exe -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
+    & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
     & move "$pkg_download.part" "$pkg_download"
 }
 
@@ -50,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
 }