From 28c3912382e114b54c97635ed89958b56dd341fc Mon Sep 17 00:00:00 2001 From: Sertonix Date: Mon, 8 Apr 2024 14:59:32 +0200 Subject: [PATCH] abuild: simplify shell completion checks --- abuild.in | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/abuild.in b/abuild.in index 0263ebd..49bd4a4 100644 --- a/abuild.in +++ b/abuild.in @@ -590,15 +590,12 @@ subpkg_set() { subpkgsplit=${_splitarch%%:*} if [ -z "$subpkgsplit" ]; then - if is_bashcomp_pkg "$subpkgname"; then - subpkgsplit=bashcomp - elif is_zshcomp_pkg "$subpkgname"; then - subpkgsplit=zshcomp - elif is_fishcomp_pkg "$subpkgname"; then - subpkgsplit=fishcomp - else - subpkgsplit="${subpkgname##*-}" - fi + case $subpkgname in + *-bash-completion) subpkgsplit=bashcomp ;; + *-zsh-completion) subpkgsplit=zshcomp ;; + *-fish-completion) subpkgsplit=fishcomp ;; + *) subpkgsplit="${subpkgname##*-}" ;; + esac fi subpkgarch=${_splitarch#*:} @@ -1382,21 +1379,6 @@ is_openrc_pkg() { test "${1%-openrc}" != "$1" } -# returns true if this is the -bash-completion package -is_bashcomp_pkg() { - test "${1%-bash-completion}" != "$1" -} - -# returns true if this is the -zsh-completion package -is_zshcomp_pkg() { - test "${1%-zsh-completion}" != "$1" -} - -# returns true if this is the -fish-completion package -is_fishcomp_pkg() { - test "${1%-fish-completion}" != "$1" -} - # check that noarch is set if needed archcheck() { options_has "!archcheck" && return 0