-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make make help colorful and simple #901
Conversation
Makefile
Outdated
@echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[32m#\n# Commands\n#---------------------------------------------------------------------------\033[0m\n" | ||
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | awk 'BEGIN {FS = ":"}; {printf "\033[33m%s:\033[0m%s\n", $$1, $$2}' | ||
@echo -e "\033[33mUsage:\033[0m\n make TARGET\n\n\033[32m#\n# Commands\n#---------------------------------------------------------------------------\033[0m\n" | ||
@sed -n -e 's|^\(.\+:\) ##\(.\+\)$$|\o033[33m\1 \o033[0m\2|p' $(MAKEFILE_LIST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One sed
does it all.
Why does that fail?
|
Is your shell Bash? |
zsh* |
I see. |
I indeed use this form in another project https://github.com/theofidry/makefile/blob/main/Makefile#L42 I probably was just too lazy to update it everywhere and forgot about it. Note I also didn't use sed, because it behaves different on OSX which is super annoying. And actually I think it's the culprit for the failure. The CI works fine as it's ubuntu, but locally I get the same as the "after" screenshot from before. |
Yes. GNU sed has an option: |
TIL |
The "one or more" I give up. Sorry. |
So I think if you revert just the |
No worries, it's a nasty one |
Compatibility is a hot topic! |
Colorful and simple.