view .chezmoiscripts/run_onchange_after_22-install-devtools.sh.tmpl @ 1096:dfa9d2a82c92 draft tip

feat: update helix
author Zeger Van de Vannet <zeger@vandevan.net>
date Sun, 18 May 2025 20:05:51 +0200
parents 9732db099471
children
line wrap: on
line source

{{ if (and (eq .chezmoi.os "linux") (or (eq .chezmoi.osRelease.name "Ubuntu" ) (eq .chezmoi.osRelease.name "Fedora Linux Asahi Remix" ))) -}}
#!/usr/bin/env bash
{{ $packages := dict
  "fd"        (dict "version" "10.2.0"  "url" "https://github.com/sharkdp/fd/releases/download/v${VERSION}/fd-v${VERSION}-${PKG_ARCH}-unknown-linux-${PKG_LIBC}.tar.gz" "arch" ((eq .chezmoi.arch "arm64") | ternary "aarch64" "i686") )
  "rg"        (dict "version" "14.1.1" "url" "https://github.com/BurntSushi/ripgrep/releases/download/${VERSION}/ripgrep-${VERSION}-${PKG_ARCH}-unknown-linux-${PKG_LIBC}.tar.gz" "arch" ((eq .chezmoi.arch "arm64") | ternary "aarch64" "x86_64") )
  "hyperfine" (dict "version" "1.19.0" "url" "https://github.com/sharkdp/hyperfine/releases/download/v${VERSION}/hyperfine-v${VERSION}-${PKG_ARCH}-unknown-linux-${PKG_LIBC}.tar.gz" "arch" ((eq .chezmoi.arch "arm64") | ternary "aarch64" "x86_64") ) -}}

set -xe

DOWNLOAD_DIR=${TMPDIR:-/tmp}/devtools
INSTALL_DIR=$HOME/bin
export MANPAGE_DIR=$HOME/.local/man

mkdir -p $MANPAGE_DIR

mkdir -p $DOWNLOAD_DIR
pushd $DOWNLOAD_DIR

{{ if (eq .chezmoi.arch "arm64") -}}
PKG_LIBC="gnu"
{{ else -}}
PKG_LIBC="musl"
{{ end }}
{{ range keys $packages | sortAlpha }}
{{ $meta :=  get $packages . -}}
VERSION={{ get $meta "version" }}
PKG_ARCH={{ get $meta "arch" }}
echo "Downloading {{ . }} v{{ get $meta "version" }} ..."
curl -fsSL {{ get $meta "url" }} | tar --strip-components=1 -xz
install -m 755 $DOWNLOAD_DIR/{{ . }} $INSTALL_DIR/{{ . }}
{{ end }}

find . -name "*.1" | xargs -I {} sh -c 'install {} "$MANPAGE_DIR/$(basename {})"'

popd
rm -rf $DOWNLOAD_DIR

FISH_COMPLETIONS=$HOME/.config/fish/completions
$INSTALL_DIR/rg --generate=complete-fish > $FISH_COMPLETIONS/rg.fish
$INSTALL_DIR/fd --gen-completions fish > $FISH_COMPLETIONS/fd.fish

{{ end }}