Skip to content

Instantly share code, notes, and snippets.

@micklove
Created February 19, 2020 08:51
Show Gist options
  • Save micklove/aea7be1f27bffa9fcb05153e450095a2 to your computer and use it in GitHub Desktop.
Save micklove/aea7be1f27bffa9fcb05153e450095a2 to your computer and use it in GitHub Desktop.
# HELP - will output the help for each task in the Makefile
# In sorted order.
# The width of the first column can be determined by the `width` value passed to awk
#
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html for the initial version.
#
help: ## This help.
@grep -E -h "^[a-zA-Z_-]+:.*?## " $(MAKEFILE_LIST) \
| sort \
| awk -v width=36 'BEGIN {FS = ":.*?## "} {printf "\033[36m%-*s\033[0m %s\n", width, $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment