Replies: 1 comment
|
I would like something similar. help: _force ## Show this help.
@perl -e '$(_HELP_FUN)' $(MAKEFILE_LIST)
@printf "Configurable variables:\n"
@cat $(MAKEFILE_LIST) | sort | perl -ne '$(_CONFIGURABLE_FUN)'
_HELP_FUN = %help; \
while(<>) { push @{$$help{$$2 // "Other"}}, [$$1, $$3] if /^([a-zA-Z\-._%]+)\s*:.*\#\#(?:@([a-zA-Z\-_]+))?\s(.*)$$/ }; \
print "$(RESET)project: $(PURPLE)$(NAME)$(RESET)\n"; \
print "usage: make [target] [VAR=value]\n\n"; \
for (sort keys %help) { \
print "$$_:\n"; \
for (@{$$help{$$_}}) { \
$$sep = " " x (25 - length $$_->[0]); \
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
}; \
print "\n"; }
_CONFIGURABLE_FUN = \
/(^[A-Z_0-9-]+)\s*\?=\s*(.*?)\s*\#\#\s*(.*)/ \
&& printf(" %-35s $(GREEN)%s$(RESET)\n", sprintf("$(YELLOW)%s$(RESET): %s", $$1, $$2), $$3)Which looks like: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have a justfile like this
Which prints a nice to view variable list, with colors, and with additional help for people who never used just

I think it would be nice to have something like that built in just
There is a
just --evaluate, but that doesn't have color output.Also it shows all variables, including exports, so all my variables are doubled
(but may be I'm doing something wrong with variables, basically i want a nice short alias for a long env variable)
All reactions