diff --git a/forks b/forks new file mode 100755 index 0000000..419c2ca --- /dev/null +++ b/forks @@ -0,0 +1,19 @@ +#!/bin/bash + +#Создан: вт 15 окт 2019 11:15:12 +#Изменён: вт 15 окт 2019 21:31:41 + +API="https://api.github.com/repos/" + +last_forks() { + curl -sq "${API}${1}/forks?sort=stargazers&per_page=100" \ + | jq -r '.[] | "\(.updated_at) \(.full_name)"' 2>&- \ + | sed "s|^| |; s|T| |; s|Z | https://github.com/|" \ + | sort -r \ + | head -n "${2:-15}" +} + +repository="${1?"USAGE $(basename "$0") user/repository ?top?"}" + +last_forks "$repository" "$2" +