diff --git a/dot_config/profile/profile.d/functions.sh.tmpl b/dot_config/profile/profile.d/functions.sh.tmpl index 10e58c6..8920c99 100644 --- a/dot_config/profile/profile.d/functions.sh.tmpl +++ b/dot_config/profile/profile.d/functions.sh.tmpl @@ -14,21 +14,6 @@ source_env_file() { )" } -#{{ if lookPath "rg" -}} -github_install_scripts () ( - rg github.com "${HOME}/.local/bin" \ - | sed 's/:/ /' \ - | sed 's/=/ /g' \ - | awk '{print $3}' \ - | sed 's|https://github.com/||g' \ - | sed 's|/| |g' \ - | awk '{print $1 " " $2}' \ - | sed 's| |/|g' \ - | sort \ - | uniq -) -#{{- end }} - make_scripts() ( for FILE in "$@"; do make_script "${FILE}" @@ -94,6 +79,31 @@ yaml_to_json() ( fi ) +#{{ if lookPath "rg" -}} +github_install_scripts () ( + rg github.com "${HOME}/.local/bin" \ + | sed 's/:/ /' \ + | sed 's/=/ /g' \ + | awk '{print $3}' \ + | sed 's|https://github.com/||g' \ + | sed 's|/| |g' \ + | awk '{print $1 " " $2}' \ + | sed 's| |/|g' \ + | sort \ + | uniq +) + +github_install_scripts_latest_releases() ( + for REPO in $(github_install_scripts); do + echo "${REPO} $(github_latest_release "${REPO}")" + done +) +#{{- end }} + +github_latest_release() ( + github_tags "$@" | head -n 1 +) + github_releases() ( USER=${1} REPO=${2-}