From 5f6108a5e2a2fc29472d6bc8121799f2ae7ba4be Mon Sep 17 00:00:00 2001 From: David Kebler Date: Mon, 22 Apr 2024 17:01:01 -0700 Subject: [PATCH] ghlatest, gets link to latest asset --- load/alias/02-git | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/load/alias/02-git b/load/alias/02-git index 481402a..c79d343 100644 --- a/load/alias/02-git +++ b/load/alias/02-git @@ -1,3 +1,15 @@ alias gitdisall="git restore ." -alias gitdis="git restore" \ No newline at end of file +alias gitdis="git restore" + + +ghlatest () { + +OWNER=${GOWNER:-$1} +REPO=${GREPO:-$2} +ARCH=${RARCH:-$3} +ARCH=${ARCH:-linux_amd64} +dwnld=$(wget https://api.github.com/repos/$OWNER/$REPO/releases/latest -q -O - | awk -F \" -v RS="," '/browser_download_url/ {print $(NF-1)}' | grep $ARCH) +echo $dwnld + +} \ No newline at end of file