fix(authors.sh): via deps_source

This commit is contained in:
2025-03-29 17:22:49 +03:00
parent 19ad6abf83
commit 2cd45c0750

View File

@ -1,20 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
_D="$HOME/.cache/bash/deps.sh"; mkdir -p "$(dirname "$_D")" && [[ ! -f $_D ]] && wget -qO "$_D" https://static.sek1.ro/libs-bash/deps/index.sh; source "$_D"
deps_source https://static.sek1.ro/libs-bash/dist/
RESPONSE=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/vSEK1RO/libbasen/contributors)
LOGIN=$(echo "$RESPONSE" | sed -n /login/p | sed 's/ \"login\": \"//' | sed 's/\",//')
CONTRIBUTIONS=$(echo "$RESPONSE" | sed -n /contributions/p | sed 's/ \"contributions\": //' | sed 's/,//')
IFS=$'\n' read -r -d '' -a arr1 <<< "$CONTRIBUTIONS"
IFS=$'\n' read -r -d '' -a arr2 <<< "$LOGIN"
AUTHORS=$'libbasen project authors:\n\n'
AUTHORS+=$(printf "%7s | %s" "commits" "username")$'\n'
for ((i = 0; i < ${#arr1[@]}; i++)); do
AUTHORS+=$(printf "%7s | %s" "${arr1[$i]}" "${arr2[$i]}")$'\n'
done
echo "$AUTHORS" > AUTHORS
dist_github_authors vSEK1RO libbasen > AUTHORS