Skip to content

Commit

Permalink
Move jq binary check
Browse files Browse the repository at this point in the history
Only check for `jq` binary if it is actually about to be used.
  • Loading branch information
HeavyWombat committed Dec 9, 2018
1 parent d9dca4c commit 81544f5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/download-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ if ! hash curl 2>/dev/null; then
exit 1
fi

if ! hash jq 2>/dev/null; then
echo -e 'Required tool \033[1mjq\033[0m is not installed.'
exit 1
fi

if [[ "$(uname -m)" != "x86_64" ]]; then
echo -e "Unsupported machine type \\033[1m$(uname -m)\\033[0m: Please check \\033[4;94mhttps://api.github.com/repos/HeavyWombat/ytbx/releases\\033[0m manually"
exit 1
fi

if [[ $# -eq 0 ]]; then
if ! hash jq 2>/dev/null; then
echo -e 'Required tool \033[1mjq\033[0m is not installed.'
exit 1
fi

# Find the latest ytbx version using the GitHub API
SELECTED_TAG="$(curl --silent --location https://api.github.com/repos/HeavyWombat/ytbx/releases | jq --raw-output '.[0].tag_name')"
else
Expand Down

0 comments on commit 81544f5

Please sign in to comment.