tmux, bash, mgmt fiddling
This commit is contained in:
parent
6649cfc78d
commit
c653422734
11 changed files with 160 additions and 11 deletions
18
private_dot_config/private_mgmt/fns/github_latest.bash
Normal file
18
private_dot_config/private_mgmt/fns/github_latest.bash
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
github_latest() {
|
||||
repo="$1"
|
||||
tag="${2:-latest}"
|
||||
if [ "$tag" = "--no-latest-tag" ]; then
|
||||
curl -sfSL "https://github.com/$repo/tags" \
|
||||
| perl -ne 'm,a href="/'"$repo"'/releases/tag/v(\d\.\d(?:.\d)?)", && print "$1\n"' \
|
||||
| sort -V \
|
||||
| tail -n1 || echo "[github error]"
|
||||
else
|
||||
curl -sfSI "https://github.com/$repo/releases/$tag" \
|
||||
| grep '^location' \
|
||||
| awk -F/ '{print $NF}' \
|
||||
| sed 's/\s\+$//' || echo "[github error]"
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue