git: 69709b474bb7 - main - dns/dog: Simplify shell completion installation

From: Lewis Cook <lcook_at_FreeBSD.org>
Date: Tue, 13 Dec 2022 21:15:43 UTC
The branch main has been updated by lcook:

URL: https://cgit.FreeBSD.org/ports/commit/?id=69709b474bb799f6393c4b43a0b828403cd4656f

commit 69709b474bb799f6393c4b43a0b828403cd4656f
Author:     Lewis Cook <lcook@FreeBSD.org>
AuthorDate: 2022-12-13 20:55:16 +0000
Commit:     Lewis Cook <lcook@FreeBSD.org>
CommitDate: 2022-12-13 21:11:45 +0000

    dns/dog: Simplify shell completion installation
---
 dns/dog/Makefile  | 20 +++++++++-----------
 dns/dog/pkg-plist |  4 ----
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/dns/dog/Makefile b/dns/dog/Makefile
index d1c4744b6049..b0bf180fa362 100644
--- a/dns/dog/Makefile
+++ b/dns/dog/Makefile
@@ -94,27 +94,25 @@ CARGO_CRATES=	addr2line-0.14.0 \
 		winreg-0.6.2 \
 		mutagen,mutagen-core,mutagen-transform@git+https://github.com/llogiq/mutagen\#c7abc956a10e8a3e2cc71f21279ea0a42f7b7c10
 
+PLIST_FILES=	bin/${PORTNAME}
 PORTDOCS=	README.md
 
 OPTIONS_DEFINE=		COMPLETIONS DOCS
 OPTIONS_DEFAULT=	COMPLETIONS
-OPTIONS_SUB=		yes
 
-COMPLETIONS_DESC=	Install shell completions for bash, fish and zsh
+COMPLETIONS_DESC=		Install bash, fish and zsh shell completions
+COMPLETIONS_PLIST_FILES=	share/bash-completion/completions/${PORTNAME} \
+				share/fish/vendor_completions.d/${PORTNAME}.fish \
+				share/zsh/site-functions/_${PORTNAME}
 
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
 
 post-install-COMPLETIONS-on:
-	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
-	${INSTALL_DATA} ${WRKSRC}/completions/${PORTNAME}.bash \
-		${STAGEDIR}${PREFIX}/etc/bash_completion.d/${PORTNAME}
-	@${MKDIR} ${STAGEDIR}${PREFIX}/share/fish/completions
-	${INSTALL_DATA} ${WRKSRC}/completions/${PORTNAME}.fish \
-		${STAGEDIR}${PREFIX}/share/fish/completions/${PORTNAME}.fish
-	@${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
-	${INSTALL_DATA} ${WRKSRC}/completions/${PORTNAME}.zsh \
-		${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
+.for _shell in bash fish zsh
+	${INSTALL_DATA} ${WRKSRC}/completions/${PORTNAME}.${_shell} \
+		${STAGEDIR}${PREFIX}/${COMPLETIONS_PLIST_FILES:M*${_shell}*}
+.endfor
 
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
diff --git a/dns/dog/pkg-plist b/dns/dog/pkg-plist
deleted file mode 100644
index ed035134fc7e..000000000000
--- a/dns/dog/pkg-plist
+++ /dev/null
@@ -1,4 +0,0 @@
-bin/dog
-%%COMPLETIONS%%etc/bash_completion.d/dog
-%%COMPLETIONS%%share/fish/completions/dog.fish
-%%COMPLETIONS%%share/zsh/site-functions/_dog