PREFIX=/usr/local/bin
RELEASE=v0.0.3
FILENAME=''
if uname -a | grep -qi 'x86_64.*GNU/Linux'; then
echo 'x86_64 GNU/Linux detected.'
FILENAME=tagref-x86_64-unknown-linux-gnu
fi
if uname -a | grep -qi 'Darwin.*x86_64'; then
echo 'macOS detected.'
FILENAME=tagref-x86_64-apple-darwin
fi
if [ -z "$FILENAME" ]; then
echo 'Unfortunately, there is no pre-built binary for this platform.' 1>&2
exit 1
fi
if ! curl -LSf "https://github.com/stepchowfun/tagref/releases/download/$RELEASE/$FILENAME" -o "$PREFIX/tagref"; then
echo 'There was an error downloading the binary.' 1>&2
exit 1
fi
if ! chmod a+rx "$PREFIX/tagref"; then
echo 'There was an error setting the permissions for the binary.' 1>&2
exit 1
fi
echo 'Tagref is now installed.'