.ONESHELL:
.DEFAULT_GOAL:=help
SHELL:=/bin/bash
PACKAGE_NAME:=jobbergate_cli

.PHONY: install
install:
	uv sync

.PHONY: test
test: install
	uv run pytest

.PHONY: lint
lint: install
	uv run ruff check tests ${PACKAGE_NAME}

.PHONY: mypy
mypy: install
	uv run mypy ${PACKAGE_NAME} --pretty

.PHONY: format
format: install
	uv run ruff format tests ${PACKAGE_NAME}

.PHONY: qa
qa: test lint mypy format
	echo "All quality checks pass!"

.PHONY: changes
changes:
	towncrier create --dir .. --section CLI

.PHONY: clean
clean:
	@find . -iname '*.pyc' -delete
	@find . -iname '*.pyo' -delete
	@find . -iname '*~' -delete
	@find . -iname '*.swp' -delete
	@find . -iname '__pycache__' -delete
	@rm -rf .mypy_cache
	@rm -rf .pytest_cache
	@find . -name '*.egg' -print0|xargs -0 rm -rf --
	@rm -rf .eggs/
	@rm -fr build/
	@rm -fr dist/
	@rm -fr *.egg-info

.PHONY: help
help: # Display target comments in 'make help'
	grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
