mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
set -u
|
|
|
|
function __install_rg() {
|
|
|
|
|
|
###################
|
|
# Install ripgrep #
|
|
###################
|
|
|
|
# Every package should define these 6 variables
|
|
pkg_cmd_name="rg"
|
|
|
|
pkg_dst_cmd="$HOME/.local/bin/rg"
|
|
pkg_dst="$pkg_dst_cmd"
|
|
|
|
pkg_src_cmd="$HOME/.local/opt/rg-v$WEBI_VERSION/bin/rg"
|
|
pkg_src_dir="$HOME/.local/opt/rg-v$WEBI_VERSION"
|
|
pkg_src="$pkg_src_cmd"
|
|
|
|
# pkg_install must be defined by every package
|
|
pkg_install() {
|
|
# ~/.local/opt/rg-v12.1.1/bin
|
|
mkdir -p "$(dirname $pkg_src_cmd)"
|
|
|
|
# mv ./ripgrep-*/rg ~/.local/opt/rg-v12.1.1/bin/rg
|
|
mv ./ripgrep-*/rg "$pkg_src_cmd"
|
|
}
|
|
|
|
# pkg_get_current_version is recommended, but (soon) not required
|
|
pkg_get_current_version() {
|
|
# 'rg --version' has output in this format:
|
|
# ripgrep 12.1.1 (rev 7cb211378a)
|
|
# -SIMD -AVX (compiled)
|
|
# +SIMD -AVX (runtime)
|
|
# This trims it down to just the version number:
|
|
# 12.1.1
|
|
echo $(rg --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
|
|
}
|
|
}
|