proj/pkgcore/pkgdev:main commit in: /, data/share/bash-completion/completions/, data/share/zsh/site-functions/

"Arthur Zamarin" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786640875.82c3dea05cbb51286be5a9a5b6d4368c8fa62110.arthurzam@gentoo>
commit:     82c3dea05cbb51286be5a9a5b6d4368c8fa62110
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 17:07:55 2026 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 17:07:55 2026 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=82c3dea0

bugs: complete stabilization groups in bash and zsh

pkgdev bugs takes stabilization groups as targets, so complete them from
metadata/stabilization-groups, nested names included. They only show up
once the leading "@" is typed, keeping the usual completion untouched
otherwise.

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

 NEWS.rst                                      |  3 +++
 data/share/bash-completion/completions/pkgdev | 16 +++++++++++++++-
 data/share/zsh/site-functions/_pkgdev         | 16 ++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/NEWS.rst b/NEWS.rst
index a39e265..6e4a730 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -14,6 +14,9 @@ pkgdev 0.2.17 (unreleased)
 
 **pkgdev bugs:**
 
+- bugs: bash and zsh completion now complete stabilization groups as targets,
+  offered once the leading ``@`` is typed (Arthur Zamarin)
+
 - bugs: fix obsoleting an older bug being a noop when an exact match bug was
   found for the same node, when merging nodes, or when no new bugs were left
   to file (Arthur Zamarin)

diff --git a/data/share/bash-completion/completions/pkgdev b/data/share/bash-completion/completions/pkgdev
index dd6c80c..0051a1d 100644
--- a/data/share/bash-completion/completions/pkgdev
+++ b/data/share/bash-completion/completions/pkgdev
@@ -46,6 +46,16 @@ _pkgdev() {
         fi
     }
 
+    _list_stabilization_groups() {
+        local base group groups=()
+        base="$(git rev-parse --show-toplevel 2>/dev/null)/metadata/stabilization-groups"
+        [[ -d ${base} ]] || return
+        while IFS= read -r group; do
+            groups+=("@${group%.group}")
+        done < <(find "${base}" -type f -name '*.group' -printf '%P\n' 2>/dev/null)
+        compgen -W "${groups[*]}" -- "${cur}"
+    }
+
     if [[ ${prev} = "--color" ]]; then
         COMPREPLY=($(compgen -W "${boolean_options}" -- "${cur}"))
         return
@@ -292,7 +302,11 @@ _pkgdev() {
                     _filedir
                     ;;
                 *)
-                    COMPREPLY+=($(compgen -W "${subcmd_options}" -- "${cur}"))
+                    if [[ ${cur} == @* ]]; then
+                        COMPREPLY+=($(_list_stabilization_groups))
+                    else
+                        COMPREPLY+=($(compgen -W "${subcmd_options}" -- "${cur}"))
+                    fi
                     ;;
             esac
             ;;

diff --git a/data/share/zsh/site-functions/_pkgdev b/data/share/zsh/site-functions/_pkgdev
index a691613..f8435a9 100644
--- a/data/share/zsh/site-functions/_pkgdev
+++ b/data/share/zsh/site-functions/_pkgdev
@@ -1,5 +1,20 @@
 #compdef pkgdev
 
+(( $+functions[_pkgdev_stabilization_groups] )) ||
+_pkgdev_stabilization_groups() {
+  [[ $PREFIX == '@'* ]] || return 1
+
+  local base
+  base="$(git rev-parse --show-toplevel 2>/dev/null)/metadata/stabilization-groups"
+  [[ -d $base ]] || return 1
+
+  local -a groups
+  groups=( $base/**/*.group(N.:r) )
+  groups=( ${groups#"$base"/} )
+  groups=( "@"${^groups} )
+  _describe -t stabilization-groups 'stabilization group' groups
+}
+
 typeset -a base_options
 local curcontext=$curcontext state state_descr line ret=1
 
@@ -138,6 +153,7 @@ case $state in
           '--stabletime[stable request timeframe in days]:days' \
           {'(--stablereq)-s','(-s)--stablereq'}'[file stable request bugs]' \
           {'(--keywording)-k','(-k)--keywording'}'[file rekeywording bugs]' \
+          '*:target:_pkgdev_stabilization_groups' \
           && ret=0
         ;;
     esac
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.