pretty.mk 732 B

12345678910111213141516171819202122232425262728293031
  1. MSG_WIDTH=70
  2. define decorate
  3. TITLE=$(strip $1);\
  4. LABEL=$@;\
  5. TITLE_LEN=$$(( $${#TITLE} + 2));\
  6. LEFT_PAD=$$(( (${MSG_WIDTH} - $${TITLE_LEN}) / 2));\
  7. RIGHT_PAD=$$(( $${LEFT_PAD} + $${TITLE_LEN} % 2 ));\
  8. if [ "${TRAVIS}" = "true" ]; then\
  9. echo -e "travis_fold:start:$${LABEL}";\
  10. echo -e "\033[1m\033[33m$${TITLE}\033[0m";\
  11. else\
  12. printf '=%.0s' {1..${MSG_WIDTH}};\
  13. printf "\n";\
  14. for ((i=1; i<= $${LEFT_PAD}; i++)); do\
  15. printf "=";\
  16. done;\
  17. printf " $${TITLE} ";\
  18. for ((i=1; i<= $${RIGHT_PAD}; i++)); do\
  19. printf "=";\
  20. done;\
  21. printf "\n";\
  22. printf '=%.0s' {1..${MSG_WIDTH}};\
  23. printf "\n";\
  24. fi ;\
  25. $(2) &&\
  26. if [ "${TRAVIS}" = "true" ]; then \
  27. echo -e "travis_fold:end:$${LABEL}"; \
  28. fi
  29. endef