#!/bin/bash

# Get current script path
SCRIPT_PATH="$( dirname -- "$( readlink -f -- "${0}"; )"; )"
# Activate OctoDNS Python venv
source "${SCRIPT_PATH}/common.sh"

cd docs

if [ -z "$BUILDER" ]; then
    BUILDER=html
fi

build="_build/${BUILDER}"
rm -rf "$build" api/cmds/ api/helpers/ api/processors/ api/providers/ api/records/ api/secrets/ api/sources/ api/validators/

sphinx-build --builder "$BUILDER" --conf-dir . --fail-on-warning "$@" "." "$build"
