32 lines
894 B
Bash
Executable File
32 lines
894 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Install tea (the Gitea CLI) if it is not present, and verify the login.
|
|
|
|
set -euo pipefail
|
|
|
|
GITEA_URL="https://git.teletypegames.org"
|
|
|
|
if command -v tea >/dev/null 2>&1; then
|
|
echo "tea already installed: $(command -v tea) ($(tea --version | head -1))"
|
|
else
|
|
if ! command -v brew >/dev/null 2>&1; then
|
|
echo "ERROR: neither tea nor Homebrew found. Install manually:" >&2
|
|
echo " https://gitea.com/gitea/tea/releases" >&2
|
|
exit 1
|
|
fi
|
|
echo "Installing tea via Homebrew..."
|
|
brew install tea
|
|
fi
|
|
|
|
# Login check: tea repo list does not work without it.
|
|
if tea login list --output json 2>/dev/null | grep -q '"name"'; then
|
|
echo "tea login OK:"
|
|
tea login list
|
|
else
|
|
echo
|
|
echo "No tea login configured yet. Create one:"
|
|
echo " tea login add --name ttg --url $GITEA_URL"
|
|
echo "(generate a token at: $GITEA_URL/user/settings/applications)"
|
|
exit 1
|
|
fi
|