add completion generation to makefile

This commit is contained in:
Daylin Morgan 2022-10-06 10:53:31 -05:00
parent 2c0c3320ee
commit 50d64368f9
2 changed files with 9 additions and 2 deletions

View file

@ -2,7 +2,7 @@
.PHONY: lint .PHONY: lint
lint: lint.py lint.sh 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 ## lint.py | lint python files
.PHONY: lint.py .PHONY: lint.py
@ -16,6 +16,11 @@ lint.sh:
$(call msg,Linting Shell Files) $(call msg,Linting Shell Files)
@shfmt -s -w $(shell shfmt -f .) @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 ## db, d-build | build docker image
.PHONY: db d-build .PHONY: db d-build
db d-build: db d-build:

View file

@ -1,9 +1,11 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
CURDIR=${0:a:h}
gen() { gen() {
if is-executable $1; then if is-executable $1; then
echo "$1 updated" echo "$1 updated"
"$@" | sed "s#$HOME#\$HOME#g" >"_$argv[1]" "$@" | sed "s#$HOME#\$HOME#g" > $CURDIR/"_$argv[1]"
else else
echo "skipping $1" echo "skipping $1"
fi fi