From 50d64368f9ccd3009454d471e1954508d20822bc Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 6 Oct 2022 10:53:31 -0500 Subject: [PATCH] add completion generation to makefile --- Makefile | 7 ++++++- lib/completions/update.sh | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a1922ab..a7aa088 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ .PHONY: lint lint: lint.py lint.sh -msg = $(call tprint,{a.b_magenta}==>{a.end}{a.bold} $(1){a.end}) +msg = $(if tprint,$(call tprint,{a.b_magenta}==>{a.end}{a.bold} $(1){a.end}),@echo '==> $(1)') ## lint.py | lint python files .PHONY: lint.py @@ -16,6 +16,11 @@ lint.sh: $(call msg,Linting Shell Files) @shfmt -s -w $(shell shfmt -f .) +## completions | generate completion scripts +completions: + $(call msg,Generating Completions) + @./lib/completions/update.sh + ## db, d-build | build docker image .PHONY: db d-build db d-build: diff --git a/lib/completions/update.sh b/lib/completions/update.sh index 9179e5b..c102e1c 100755 --- a/lib/completions/update.sh +++ b/lib/completions/update.sh @@ -1,9 +1,11 @@ #!/usr/bin/env zsh +CURDIR=${0:a:h} + gen() { if is-executable $1; then echo "$1 updated" - "$@" | sed "s#$HOME#\$HOME#g" >"_$argv[1]" + "$@" | sed "s#$HOME#\$HOME#g" > $CURDIR/"_$argv[1]" else echo "skipping $1" fi