Skip to content

Commit dd54170

Browse files
committed
build: add Makefile
1 parent 27f1127 commit dd54170

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Makefile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Makefile
2+
.DEFAULT_GOAL := help
3+
4+
# Colors
5+
RED := $(shell tput -Txterm setaf 1)
6+
GREEN := $(shell tput -Txterm setaf 2)
7+
BLUE := $(shell tput -Txterm setaf 4)
8+
CYAN := $(shell tput -Txterm setaf 6)
9+
RESET := $(shell tput -Txterm sgr0)
10+
11+
## Commands
12+
13+
test: ## Run the pkg tests
14+
@go test -v ./pkg/...
15+
16+
## Help
17+
18+
# https://gist.github.com/thomaspoignant/5b72d579bd5f311904d973652180c705
19+
help: ## Show this help
20+
@echo
21+
@echo 'Usage:'
22+
@echo ' ${CYAN}make${RESET} ${GREEN}<target>${RESET}'
23+
@echo
24+
@echo 'Targets:'
25+
@awk 'BEGIN {FS = ":.*?## "} { \
26+
if (/[a-zA-Z_\-]+:.*?##.*$$/) {printf " ${CYAN}%-25s${GREEN}%s${RESET}\n", $$1, $$2} \
27+
else if (/^## .*$$/) {printf " ${BLUE}%s${RESET}\n", substr($$1,4)} \
28+
}' $(MAKEFILE_LIST)
29+
@echo

0 commit comments

Comments
 (0)