1
0
mirror of https://github.com/captainark/github2email.git synced 2024-11-14 13:37:39 +01:00

check for dependencies before doing stuff

This commit is contained in:
CaptainArk 2018-04-19 23:16:51 +02:00
parent 7c343cd6b8
commit b5ec9eda3b

View File

@ -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%,*}