#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"

SWAG_BIN="${SWAG_BIN:-/tmp/go/bin/swag}"
if [ ! -x "${SWAG_BIN}" ]; then
  echo "swag introuvable: ${SWAG_BIN}" >&2
  exit 1
fi

cd "${ROOT_DIR}"
"${SWAG_BIN}" init -g cmd/app/main.go -o docs
