Skip to content

Commit bf55d13

Browse files
authored
Adds pre-commit to deps-reqs-versions, lets which be changed
which is an executable, and someone might want to replace it with `pyenv which` or `poetry run which`.
1 parent b5712ab commit bf55d13

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,24 +174,26 @@ $(GIT_HOOKS): .pre-commit-config.yaml
174174

175175
.PHONY: deps-reqs-versions
176176
deps-reqs-versions: ## Check if shell $PATH has requirements and show their version
177-
@echo "$(COLOR_BLUE)Checking PATH elements for evidence of package managers. The first in each section is what's used.$(COLOR_RESET)"
177+
@echo "$(COLOR_BLUE)Checking PATH elements for evidence of required tools. The first in each section is what's used.$(COLOR_RESET)"
178178
@$(MAKE) paths-version-for-cmd CMD=poetry
179179
@$(MAKE) paths-version-for-cmd CMD=pyenv
180180
@$(MAKE) paths-version-for-cmd CMD=brew
181181
@$(MAKE) paths-version-for-cmd CMD=curl
182182
@$(MAKE) paths-version-for-cmd CMD=git
183+
@$(MAKE) paths-version-for-cmd CMD=pre-commit
183184
@echo "$(COLOR_GREEN)All expected PATH elements found$(COLOR_RESET)"
184185

185186
CMD_VERSION_FLAG ?= --version
187+
WHICH ?= which
186188
.PHONY: paths-version-for-cmd
187189
paths-version-for-cmd: ## Display version for all executable paths for an executable, set CMD & CMD_VERSION_FLAG
188190
@( if [ -z "$$(which -a $(CMD))" ]; then \
189-
echo "==> $(COLOR_RED)missing $(CMD)$(COLOR_RESET)"; \
191+
echo "==> $(COLOR_RED)missing $(CMD)$(COLOR_RESET)"; \
190192
else \
191-
echo "==> $(COLOR_ORANGE)$(CMD) $(COLOR_BLUE)commands' versions are:$(COLOR_RESET)"; \
192-
for pth in $$(which -a $(CMD)); do \
193-
echo "$(COLOR_BLUE)$${pth}$(COLOR_RESET) : $$("$${pth}" $(CMD_VERSION_FLAG))"; \
194-
done; \
193+
echo "==> $(COLOR_ORANGE)$(CMD) $(COLOR_BLUE)commands' versions are:$(COLOR_RESET)"; \
194+
for pth in $$($(WHICH) -a $(CMD)); do \
195+
echo "$(COLOR_BLUE)$${pth}$(COLOR_RESET) : $$("$${pth}" $(CMD_VERSION_FLAG))"; \
196+
done; \
195197
fi )
196198

197199
##@ Dependencies

0 commit comments

Comments
 (0)