Skip to content

Instantly share code, notes, and snippets.

@hugoprudente
Created February 25, 2021 21:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hugoprudente/05eb070821b1694b45f118b49255fc2b to your computer and use it in GitHub Desktop.
Save hugoprudente/05eb070821b1694b45f118b49255fc2b to your computer and use it in GitHub Desktop.
Makefile with help
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-30s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help:
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
image: secrets ## Build the container image.
docker build --file Dockerfile
@hugoprudente
Copy link
Author

hugoprudente commented Feb 25, 2021

The output will be like:

on ⛵ k3s () sidecar on  JIRA-1[$!?⇡] via 🐍 v3.9.1 (osx) took 14s
➜ make
image                          Build the container image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment