default:
    @just --list

lint:
    uv run ruff check .

lint-fix:
    uv run ruff check --fix .

format:
    uv run ruff format .

format-check:
    uv run ruff format --check .

typecheck:
    uv run mypy ocpy

test k="":
    uv run pytest -v --tb=short -s {{ if k != "" { "-k '" + k + "'" } else { "" } }}

test-quiet k="":
    uv run pytest {{ if k != "" { "-k '" + k + "'" } else { "" } }}

test-reads k="":
    uv run pytest -m reads -v --tb=short -s {{ if k != "" { "-k '" + k + "'" } else { "" } }}

test-writes k="":
    uv run pytest -m writes -v --tb=short -s {{ if k != "" { "-k '" + k + "'" } else { "" } }}

test-config:
    @uv run python -c "import yaml,sys,os; f='tests/.test.creds.yml'; d=yaml.safe_load(open(f)) if os.path.exists(f) else (print('Datei nicht gefunden: '+f) or sys.exit(1)); print('Server:     ',d.get('server_url','?')); print('User:       ',d.get('user','?')); print('Digest User:',d.get('digest_user','?'))"

test-list:
    uv run pytest --collect-only -q

build:
    uv build

publish: build
    uv publish \
        --username "$(awk -F ' = ' '/username/ {print $2}' ~/.pypirc)" \
        --password "$(awk -F ' = ' '/password/ {print $2}' ~/.pypirc)"
