git: b5143c450942 - main - deskutils/just: Add COMPLETIONS option, ON by default

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 16 Aug 2023 16:26:54 UTC
The branch main has been updated by yuri:

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

commit b5143c4509426867c175d5c67ab0b9f8b2b76afc
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-08-16 14:31:59 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-08-16 16:26:52 +0000

    deskutils/just: Add COMPLETIONS option, ON by default
    
    PR:             273158
    Requested by:   Michael Adler <therisen06@gmail.com>
---
 deskutils/just/Makefile | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/deskutils/just/Makefile b/deskutils/just/Makefile
index c7811dc77ba1..17191fb1d797 100644
--- a/deskutils/just/Makefile
+++ b/deskutils/just/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	just
 DISTVERSION=	1.14.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	deskutils
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -137,7 +137,21 @@ CARGO_CRATES=	aho-corasick-1.0.1 \
 		yansi-0.5.1
 PLIST_FILES=	bin/${PORTNAME}
 
+OPTIONS_DEFINE=		COMPLETIONS
+OPTIONS_DEFAULT=	COMPLETIONS
+
+COMPLETIONS_DESC=		Build and 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:
+.for _shell in bash fish zsh
+	${STAGEDIR}${PREFIX}/bin/${PORTNAME} --completions ${_shell} \
+		>${STAGEDIR}${PREFIX}/${COMPLETIONS_PLIST_FILES:M*${_shell}*}
+.endfor
+
 .include <bsd.port.mk>