Update 'kfg'

This commit is contained in:
2023-05-27 21:05:39 +02:00
parent b5a9e566be
commit 01663576b5

26
kfg
View File

@@ -328,6 +328,30 @@ function github_install {
}
function github_download_config {
ensure get_architecture
local _program=$1
local _arch="${RETVAL}"
local _repo=$2
local _url="https://api.github.com/repos/$_repo/releases/latest"
local _file=$3
assert_nz "${_arch}" "arch"
need_cmd grep
download "${_url}"
local _releases=$RETVAL
(echo "${_releases}" | grep -q 'API rate limit exceeded') && (log_error "GitHub API rate limit exceeded. Please try again later." || return 1)
local _tag_name _remote_file _path
_tag_name="$(echo "${_releases}" | grep "tag_name" | cut -d '"' -f 4)"
_remote_file="https://raw.githubusercontent.com/$_repo/$_tag_name/$_file"
download_config "$_program" "$_file" "$_remote_file"
}
function install_deb_check {
CHECK_CURRENT=$(dpkg -s "$1" | grep -E "Status|Version")
#INSTALLED_CURRENT=$(echo $CHECK_CURRENT | grep -oE "Status: .*" | cut -d ' ' -f 2)
@@ -586,6 +610,8 @@ function p_fzf {
fi
install_rc_download fzf "fzf.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/fzf/fzf.rc"
github_download_config "fzf" "$_repo" "shell/completion.zsh"
github_download_config "fzf" "$_repo" "shell/key-bindings.zsh"
}
function p_fzf_tab {