mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-23 22:16:48 +00:00
feature(delta): add *nix and Windows installer + cheat sheet
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: delta
|
||||
homepage: https://github.com/dandavison/delta
|
||||
tagline: |
|
||||
delta: A syntax-highlighting pager for git and diff output
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi delta` (or `@0.9.1`, `@0.9.0`,
|
||||
etc).
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
Install delta and add this to your `~/.gitconfig`:
|
||||
|
||||
```gitconfig
|
||||
[pager]
|
||||
diff = delta
|
||||
show = delta
|
||||
log = delta
|
||||
blame = delta
|
||||
reflog = delta
|
||||
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
```
|
||||
|
||||
Make sure to check out the helpful [ReadMe](https://github.com/dandavison/delta/blob/master/README.md)
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
##################
|
||||
# Install delta #
|
||||
##################
|
||||
|
||||
# Every package should define these variables
|
||||
$pkg_cmd_name = "delta"
|
||||
|
||||
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\delta.exe"
|
||||
$pkg_dst = "$pkg_dst_cmd"
|
||||
|
||||
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION\bin\delta.exe"
|
||||
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION\bin"
|
||||
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION"
|
||||
$pkg_src = "$pkg_src_cmd"
|
||||
|
||||
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
|
||||
$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"
|
||||
& move "$pkg_download.part" "$pkg_download"
|
||||
}
|
||||
|
||||
IF (!(Test-Path -Path "$pkg_src_cmd"))
|
||||
{
|
||||
echo "Installing delta"
|
||||
|
||||
# TODO: create package-specific temp directory
|
||||
# Enter tmp
|
||||
pushd .local\tmp
|
||||
|
||||
# Remove any leftover tmp cruft
|
||||
Remove-Item -Path ".\delta-v*" -Recurse -ErrorAction Ignore
|
||||
Remove-Item -Path ".\delta.exe" -Recurse -ErrorAction Ignore
|
||||
|
||||
# Unpack archive file into this temporary directory
|
||||
# Windows BSD-tar handles zip. Imagine that.
|
||||
echo "Unpacking $pkg_download"
|
||||
& tar xf "$pkg_download"
|
||||
|
||||
# Settle unpacked archive into place
|
||||
echo "Install Location: $pkg_src_cmd"
|
||||
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
|
||||
Move-Item -Path ".\delta-*\delta.exe" -Destination "$pkg_src_bin"
|
||||
|
||||
# Exit tmp
|
||||
popd
|
||||
}
|
||||
|
||||
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
|
||||
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __init_delta() {
|
||||
|
||||
|
||||
#################
|
||||
# Install delta #
|
||||
#################
|
||||
|
||||
# Every package should define these 6 variables
|
||||
pkg_cmd_name="delta"
|
||||
|
||||
pkg_dst_cmd="$HOME/.local/bin/delta"
|
||||
pkg_dst="$pkg_dst_cmd"
|
||||
|
||||
pkg_src_cmd="$HOME/.local/opt/delta-v$WEBI_VERSION/bin/delta"
|
||||
pkg_src_dir="$HOME/.local/opt/delta-v$WEBI_VERSION"
|
||||
pkg_src="$pkg_src_cmd"
|
||||
|
||||
# pkg_install must be defined by every package
|
||||
pkg_install() {
|
||||
# ~/.local/opt/delta-v0.99.9/bin
|
||||
mkdir -p "$(dirname $pkg_src_cmd)"
|
||||
|
||||
# mv ./delta-*/delta ~/.local/opt/delta-v0.99.9/bin/delta
|
||||
mv ./delta-*/delta "$pkg_src_cmd"
|
||||
}
|
||||
|
||||
# pkg_get_current_version is recommended, but not required
|
||||
pkg_get_current_version() {
|
||||
# 'delta --version' has output in this format:
|
||||
# delta 0.9.2
|
||||
# This trims it down to just the version number:
|
||||
# 0.9.2
|
||||
delta --version 2> /dev/null |
|
||||
head -n 1 |
|
||||
cut -d ' ' -f 2
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
__init_delta
|
||||
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var github = require('../_common/github.js');
|
||||
var owner = 'dandavison';
|
||||
var repo = 'delta';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 15 for demonstration
|
||||
all.releases = all.releases.slice(0, 15);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
@@ -14,6 +14,7 @@ function __rmrf_local() {
|
||||
chromedriver \
|
||||
comrak \
|
||||
curlie \
|
||||
delta \
|
||||
deno \
|
||||
dotenv \
|
||||
dotenv-linter \
|
||||
@@ -103,6 +104,7 @@ function __rmrf_local() {
|
||||
chromedriver \
|
||||
comrak \
|
||||
curlie \
|
||||
delta \
|
||||
deno \
|
||||
dotenv \
|
||||
dotenv-linter \
|
||||
@@ -196,6 +198,7 @@ function __test() {
|
||||
chromedriver \
|
||||
comrak \
|
||||
curlie \
|
||||
delta \
|
||||
deno \
|
||||
dotenv \
|
||||
dotenv-linter \
|
||||
|
||||
Reference in New Issue
Block a user