diff --git a/authors.sh b/authors.sh index 2be74b4..de3ac1e 100755 --- a/authors.sh +++ b/authors.sh @@ -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 \ No newline at end of file +dist_github_authors vSEK1RO libbasen > AUTHORS \ No newline at end of file