Makefile 653 B

123456789101112131415161718192021222324252627282930313233
  1. SUFFIX := plugin.zsh
  2. PLUGINS := zoxide hatch pipx broot
  3. # DIFF := diff -du --color
  4. DIFF := delta
  5. .PHONY: all
  6. all: $(foreach x,${PLUGINS},${x}.${SUFFIX})
  7. # ${1}: cmd
  8. define plugin
  9. {${1}; } > new.${@}
  10. @[ -f "${@}" ] && ${DIFF} ${@} new.${@} ||:
  11. @mv new.${@} ${@}
  12. endef
  13. .PHONY: zoxide.${SUFFIX}
  14. zoxide.${SUFFIX}:
  15. $(call plugin, zoxide init zsh --cmd cd --hook pwd)
  16. .PHONY: hatch.${SUFFIX}
  17. hatch.${SUFFIX}:
  18. $(call plugin, _HATCH_COMPLETE=zsh_source hatch)
  19. .PHONY: pipx.${SUFFIX}
  20. pipx.${SUFFIX}:
  21. $(call plugin, register-python-argcomplete -s zsh pipx)
  22. .PHONY: broot.${SUFFIX}
  23. broot.${SUFFIX}:
  24. $(call plugin, broot --print-shell-function zsh)