docs: update makefile help

This commit is contained in:
Kevin Franklin Kim 2025-09-16 16:37:00 +02:00
parent eca9512323
commit 1f5fb6284b
No known key found for this signature in database

View File

@ -12,7 +12,7 @@
.mise:
@mise install
## === Tasks ===
### Tasks
.PHONY: doc
## Run tests
@ -24,8 +24,8 @@ doc:
## Run tests
test:
@# see https://github.com/pterm/pterm/issues/482
@GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -json ./... | gotestfmt
@#GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -race -json ./... | gotestfmt
@GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out
@#GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -race
.PHONY: lint
## Run linter
@ -60,43 +60,23 @@ build:
@echo "building bin/squadron"
@go build -tags=safe -o bin/squadron cmd/main.go
## === Docker ===
.PHONY: docker
## Build docker image
docker:
@docker buildx build -t foomo/squadron:latest .
## === Utils ===
### Utils
.PHONY: help
## Show help text
help:
@echo "\033[1;36mSquadron | Compose for Kubernetes\033[0m"
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-23s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
if (helpMessage) { \
printf "\033[36m%-23s\033[0m %s\n", \
helpCommand, helpMessage"\n"; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (helpMessage) { \
helpMessage = helpMessage"\n "substr($$0, 3); \
} else { \
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
print "\n "helpMessage"\n" \
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)
if($$0 ~ /^### /){ \
if(help) printf "\033[36m%-23s\033[0m %s\n\n", cmd, help; help=""; \
printf "\n\033[1;36m%s\033[0m\n", substr($$0,5); \
} else if($$0 ~ /^[a-zA-Z0-9._-]+:/){ \
cmd = substr($$0, 1, index($$0, ":")-1); \
if(help) printf " \033[36m%-23s\033[0m %s\n", cmd, help; help=""; \
} else if($$0 ~ /^##/){ \
help = help ? help "\n " substr($$0,3) : substr($$0,3); \
} else if(help){ \
print "\n " help "\n"; help=""; \
} \
}' $(MAKEFILE_LIST)