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