commit:     791d259dfcc7395b2e564a135de0d885aaee4104
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 24 19:29:26 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 24 19:29:26 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=791d259d

sys-apps/pkgcraft-tools: (live) build shell completions and install

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-apps/pkgcraft-tools/pkgcraft-tools-9999.ebuild | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/sys-apps/pkgcraft-tools/pkgcraft-tools-9999.ebuild 
b/sys-apps/pkgcraft-tools/pkgcraft-tools-9999.ebuild
index cd08702104d1..24e827b171dd 100644
--- a/sys-apps/pkgcraft-tools/pkgcraft-tools-9999.ebuild
+++ b/sys-apps/pkgcraft-tools/pkgcraft-tools-9999.ebuild
@@ -54,6 +54,19 @@ src_unpack() {
        fi
 }
 
+src_compile() {
+       cargo_src_compile
+
+       if [[ ${PV} == 9999 ]] ; then
+               einfo "Generating shell completions"
+               mkdir shell || die
+               local BIN="${WORKDIR}/${P}/$(cargo_target_dir)/pk"
+               "${BIN}" completion bash > shell/pk.bash || die
+               "${BIN}" completion zsh > shell/_pk || die
+               "${BIN}" completion fish > shell/pk.fish || die
+       fi
+}
+
 src_test() {
        unset CLICOLOR CLICOLOR_FORCE
 
@@ -70,9 +83,7 @@ src_test() {
 src_install() {
        cargo_src_install
 
-       if [[ ${PV} != 9999 ]] ; then
-               newbashcomp shell/pk.bash pk
-               dozshcomp shell/_pk
-               dofishcomp shell/pk.fish
-       fi
+       newbashcomp shell/pk.bash pk
+       dozshcomp shell/_pk
+       dofishcomp shell/pk.fish
 }

Reply via email to