Skip to content

feat(dev): emit descriptions for commands in help #2678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
default:
help:
@echo "Call a specific subcommand:"
@echo
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null\
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}'\
| sort\
| grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo
@exit 1

default: help

.state/docker-build-web: Dockerfile dev-requirements.txt base-requirements.txt
# Build web container for this project
Expand All @@ -29,30 +28,29 @@ default:
# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/db-initialized

serve: .state/db-initialized
serve: .state/db-initialized ## Start the application
docker compose up --remove-orphans

migrations: .state/db-initialized
# Run Django makemigrations
migrations: .state/db-initialized ## Generate migrations from models
docker compose run --rm web ./manage.py makemigrations

migrate: .state/docker-build-web
# Run Django migrate
migrate: .state/docker-build-web ## Run Django migrate
docker compose run --rm web ./manage.py migrate

manage: .state/db-initialized
# Run Django manage to accept arbitrary arguments
manage: .state/db-initialized ## Run Django manage to accept arbitrary arguments
docker compose run --rm web ./manage.py $(filter-out $@,$(MAKECMDGOALS))

shell: .state/db-initialized
shell: .state/db-initialized ## Open Django interactive shell
docker compose run --rm web ./manage.py shell

clean:
clean: ## Clean up the environment
docker compose down -v
rm -f .state/docker-build-web .state/db-initialized .state/db-migrated

test: .state/db-initialized
test: .state/db-initialized ## Run tests
docker compose run --rm web ./manage.py test

docker_shell: .state/db-initialized
docker_shell: .state/db-initialized ## Open a bash shell in the web container
docker compose run --rm web /bin/bash

.PHONY: help serve migrations migrate manage shell clean test docker_shell
Loading