#!/usr/bin/env just --justfile

set fallback

# Format documentation source files
format:
    black --quiet conf.py
    mdformat .
    {{ just_executable() }} --fmt --unstable

sphinx_module := "sphinx"

# Build documentation.
[arg("args", help="Arguments passed to sphinx")]
build *args:
    python -m {{ sphinx_module }} . _build {{ args }}

# Push documentation version
[arg("args", help="Arguments passed to docput")]
push *args:
    docput version push {{ args }} _build

# Update root files for the documentation site
[arg("args", help="Arguments passed to docput")]
update-root *args:
    docput upload --merge _root . {{ args }}
