From bfcb270cae6531489a25ec91667ba8e1f2cdc577 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Thu, 18 May 2023 21:53:54 -0700 Subject: [PATCH] Add github_tags function to get tags on github --- base/.config/profile/profile.d/base.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/base/.config/profile/profile.d/base.sh b/base/.config/profile/profile.d/base.sh index fc10aad..77288bb 100644 --- a/base/.config/profile/profile.d/base.sh +++ b/base/.config/profile/profile.d/base.sh @@ -76,6 +76,18 @@ github_releases() ( "https://api.github.com/repos/${USER}/${REPO}/releases" ) +github_tags() ( + USER=${1} + REPO=${2-} + if [ -z "${REPO}" ]; then + USER=$(echo "${1}" | sed 's|/| |g' | awk '{print $1}') + REPO=$(echo "${1}" | sed 's|/| |g' | awk '{print $2}') + fi + curl --silent --header "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/${USER}/${REPO}/tags" | + jq -r '.[].name' +) + command_installed() ( set -ue cmd=${1}