commit:     34a779aec12874226594dcda3cc8a2500a6cc999
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 12 12:02:39 2024 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Fri Apr 12 12:12:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34a779ae

dev-vcs/git-absorb: add completion script

Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 ...b-0.6.11.ebuild => git-absorb-0.6.11-r1.ebuild} | 31 +++++++++++++++++++---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/dev-vcs/git-absorb/git-absorb-0.6.11.ebuild 
b/dev-vcs/git-absorb/git-absorb-0.6.11-r1.ebuild
similarity index 73%
rename from dev-vcs/git-absorb/git-absorb-0.6.11.ebuild
rename to dev-vcs/git-absorb/git-absorb-0.6.11-r1.ebuild
index 7e47516fd076..ae2ac7412a63 100644
--- a/dev-vcs/git-absorb/git-absorb-0.6.11.ebuild
+++ b/dev-vcs/git-absorb/git-absorb-0.6.11-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2023 Gentoo Authors
+# Copyright 2023-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Autogenerated by pycargoebuild 0.6.3
@@ -76,14 +76,16 @@ CRATES="
        winapi-x86_64-pc-windows-gnu-0.4.0
 "
 
-inherit cargo
+inherit cargo shell-completion
 
 DESCRIPTION="Automatically absorb staged changes into git current branch"
 HOMEPAGE="https://github.com/tummychow/git-absorb";
-SRC_URI="$(cargo_crate_uris)"
+SRC_URI="${CARGO_CRATE_URIS}"
 SRC_URI+=" https://github.com/tummychow/${PN}/archive/refs/tags/${PV}.tar.gz 
-> ${P}.tar.gz"
 
-LICENSE="Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD BSD-2 CC0-1.0 MIT 
MPL-2.0 Unlicense ZLIB"
+LICENSE="BSD"
+# Dependent crate licenses
+LICENSE+=" MIT Unicode-DFS-2016"
 SLOT="0"
 KEYWORDS="~amd64 ~arm64"
 
@@ -91,8 +93,29 @@ DOCS=( README.md )
 
 QA_FLAGS_IGNORED="usr/bin/${PN}"
 
+src_compile() {
+       cargo_src_compile
+
+       GIT_ABSORB_BIN="target/$(usex debug debug release)/${PN}"
+
+       # Prepare shell completion generation
+       mkdir completions || die
+       local shell
+       for shell in bash fish zsh; do
+               "${GIT_ABSORB_BIN}" --gen-completions \
+                                        ${shell} \
+                                        > completions/${PN}.${shell} \
+                       || die
+       done
+}
+
 src_install() {
        cargo_src_install
        doman Documentation/${PN}.1
+
+       newbashcomp "completions/${PN}.bash" "${PN}"
+       dofishcomp "completions/${PN}.fish"
+       dozshcomp "completions/${PN}.zsh"
+
        default
 }

Reply via email to