diff --git a/github2email.sh b/github2email.sh index d9e1f4f..7ecccd8 100755 --- a/github2email.sh +++ b/github2email.sh @@ -13,6 +13,14 @@ GitHubApi="https://api.github.com/users/${UserName}/starred" LastPage="$(curl -I ${GitHubApi} | grep -Eo 'page=[[:digit:]]+' | tail -n1)" TempFile=$(mktemp -t github2email.sh.XXXXXXXXXX) +# Checking for dependencies +for Dependencies in curl jq r2e; do + if [[ ! -x $(which ${Dependencies}) ]]; then + echo "${Dependencies} is required to run to script. Exiting..." + exit 2 + fi +done + for StarPages in $(seq 1 ${LastPage#*=}); do curl -s "${GitHubApi}?page=${StarPages}" | jq -r '.[] | .name + "," + .html_url' | sed 's#$#/releases.atom#' >> ${TempFile} done @@ -23,14 +31,6 @@ if [[ ! -s ${TempFile} ]]; then exit 2 fi -# Checking for dependencies -for Dependencies in curl jq r2e; do - if [[ ! -x $(which ${Dependencies}) ]]; then - echo "${Dependencies} is required to run to script. Exiting..." - exit 2 - fi -done - # Doing our magic stuff that does cool shit for Star in $(cat ${TempFile}); do ProjectName=${Star%,*}