make-help
make-help copied to clipboard
make-help outputs a lot of extra stuff
Hello @Xanders,
Last time I raise this issue: https://github.com/Xanders/make-help/issues/4, you fixed it and I really appreciated it! (Sorry for late feedback, but it was indeed great job).
Still this time around, I have different/other/unknown issue with make-help, my Makefile has a lot of comments and notes and it conflicts with your regexp it seems.
Makefile:
# this bit exposes variables from docker_overrides to Makefile
include shared.env
export
# NOTE1: SHARED_ENV is a way to share env variables between Docker,
# docker-compose and Makefile, this way we have only one source of truth
# NOTE2: in addition because SHARED_ENV variables are exported in master
# process, before executing docker-compose, they are not only available in a
# container but as well in docker-compose, allowing variable substitution
# there
# NOTE3: there is one drawback, Makefile prints all the variables as it runs,
# making it akward stdout noise
# NOTE4: overrides become handy if for example two different docker stacks run
# mysql/rabbitmq instances and we need to set different ports for them
# this bit loads docker_overrides to SHARED_ENV variable that can be used
# later in commands
SHARED_ENV = grep --regexp ^[A-Z] shared.env | cut -d= -f1
VERSION = `cat pyproject.toml | grep "^version = \".*\"" | cut -d '"' -f2`
SOURCE_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
COMMIT = $(shell git rev-parse --short HEAD)
test ?=
test_switch ?= -s
db_dump ?= dump.sql
up = head
down = -1
tests%: export DB_PORT=5432
tests%: export DB_USER="user"
# Show this help message
# Multiple lines are supported too
# When it's first, both commands works:
# `make`
# `make help`
help:
@cat $(MAKEFILE_LIST) | docker run --rm -i xanders/make-help
# Run some python code
run:
cat example.py | python
##
## Tests
##
# Runs all tests excluding those requiring access to remote servers
run-tests:
pytest -m 'not integration' --cov=app --cov-report html ${test_switches} ${test}
# Runs all tests excluding those requiring access to remote servers, but breaks after first error
run-tests-short:
make run-tests test_switches='-sxv'
##
## Dockers
##
# Build Docker image
build:
docker build -t xanders/make-help .
# Run `build` and `help` successively
test: build help
##
## Section for authorized contributors
##
# Push image to `https://hub.docker.com`
push:
docker push xanders/make-help
And when I run make help I get:
drachenfels@zoantrope:~/Projects/experiments/makefile-experiments$ make help
Usage: make <command> [ARGUMENT1=value1] [ARGUMENT2=value2]
Commands:
SHARED_ENV = grep --regexp ^[A-Z] shared.env | cut -d= -f1
VERSION = `cat pyproject.toml | grep "^version = \".*\"" | cut -d '"' -f2`
SOURCE_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
COMMIT = $(shell git rev-parse --short HEAD)
test ?=
test_switch ?= -s
db_dump ?= dump.sql
up = head
down = -1
tests% # this bit loads docker_overrides to SHARED_ENV variable that can be used
# later in commands
For easy reproduciton this time I have a repo you can clone to try:
https://github.com/Drachenfels/make-help-test
I will add that perhaps I am using it wrong, honestly not sure what is going on in this case.
Hi @Drachenfels! Glad to hear you're trying to use my tool and, of course, sad to hear it is broken. I'll try to figure out the reason next weekend as I have a huge amount of work to do in the next few days.