Created
November 25, 2021 13:51
-
-
Save theherk/712e9b3d0bb3ff1c33658de2cc45ae01 to your computer and use it in GitHub Desktop.
Install the latest version of pre-commit locally with GNU Make.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
help: ## show help message | |
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z./_-]+:.*?##/ { printf " \033[36m%-16s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | |
bin: | |
mkdir -p $@ | |
bin/pre-commit: LATEST := ${shell curl --silent "https://api.github.com/repos/pre-commit/pre-commit/releases/latest" | jq ".. .tag_name? // empty" | tr -d '"v'} | |
bin/pre-commit: URL := https://github.com/pre-commit/pre-commit/releases/download/v${LATEST}/pre-commit-${LATEST}.pyz | |
bin/pre-commit: bin ## install pre-commit | |
curl -L ${URL} --output $@ | |
chmod +x $@ | |
@echo 'export PATH=${@D}:$$PATH # remember to add to your PATH' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment