Last active
February 26, 2022 08:54
-
-
Save cessor/93a9198b09113840b6c76beeff6b4094 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DEFAULT_GOAL := help | |
.PHONY: help | |
# Source (So cool, thanks): https://daniel.feldroy.com/posts/autodocumenting-makefiles | |
define HELP_TEXT | |
import re,sys; | |
tasks = [] | |
for line in sys.stdin: | |
match = re.match(r'^([a-zA-Z0-9_\.\-]+):.*?##(.*)$$', line) | |
if not match: continue | |
tasks.append("%-10s %s" % match.groups()) | |
print('\n'.join(tasks)) | |
endef | |
export HELP_TEXT | |
DESCRIPTION="Description" | |
help: ## Print this help | |
@echo | |
@echo $(DESCRIPTION) | |
@echo | |
@python -c "$$HELP_TEXT" < $(MAKEFILE_LIST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment