git: 50dac96090dc - main - sysutils/handlr: Add shell completion files

From: Dmitri Goutnik <dmgk_at_FreeBSD.org>
Date: Thu, 26 May 2022 22:57:47 UTC
The branch main has been updated by dmgk:

URL: https://cgit.FreeBSD.org/ports/commit/?id=50dac96090dc01e6fb3fc8dad17b1a3808883d78

commit 50dac96090dc01e6fb3fc8dad17b1a3808883d78
Author:     sec.research.2005@gmail.com <sec.research.2005@gmail.com>
AuthorDate: 2022-05-26 22:42:47 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-05-26 22:57:16 +0000

    sysutils/handlr: Add shell completion files
    
    PR:             264242
---
 sysutils/handlr/Makefile | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/sysutils/handlr/Makefile b/sysutils/handlr/Makefile
index 83485c9a5ff7..faa4f0c23c8f 100644
--- a/sysutils/handlr/Makefile
+++ b/sysutils/handlr/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	handlr
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.7.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils
 
 MAINTAINER=	sec.research.2005@gmail.com
@@ -176,7 +176,24 @@ CARGO_CRATES=	aho-corasick-0.7.18 \
 
 PLIST_FILES=	bin/handlr
 
+OPTIONS_DEFINE=		COMPLETIONS
+OPTIONS_DEFAULT=	COMPLETIONS
+
+COMPLETIONS_DESC=	Install bash, zsh, and fish 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/handlr
 
+post-install-COMPLETIONS-on:
+	${INSTALL_DATA} ${WRKSRC}/completions/${PORTNAME} \
+		${STAGEDIR}${PREFIX}/share/bash-completion/completions/${PORTNAME}
+	${INSTALL_DATA} ${WRKSRC}/completions/${PORTNAME}.fish \
+		${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/${PORTNAME}.fish
+	${INSTALL_DATA} ${WRKSRC}/completions/_${PORTNAME} \
+		${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
+
 .include <bsd.port.mk>