From a44b2704f35bf9b3e3e282dd95e97ffe6b364e04 Mon Sep 17 00:00:00 2001 From: Lucio Sauer Date: Sat, 20 Jul 2024 17:06:22 +0200 Subject: bash completion: support Closes tags with resolution _comp_ltrim_colon_completions was introduced with >=bash-completion-2.12 Signed-off-by: Lucio Sauer Signed-off-by: Arthur Zamarin --- data/share/bash-completion/completions/pkgdev | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'data') diff --git a/data/share/bash-completion/completions/pkgdev b/data/share/bash-completion/completions/pkgdev index 17eb34c..3631d64 100644 --- a/data/share/bash-completion/completions/pkgdev +++ b/data/share/bash-completion/completions/pkgdev @@ -4,7 +4,7 @@ source "/usr/share/bash-completion/helpers/gentoo-common.sh" _pkgdev() { local i=1 cmd cur prev words cword split - _init_completion || return + _init_completion -n : || return local subcommands=" bugs @@ -79,7 +79,23 @@ _pkgdev() { " case "${prev}" in - -[bcTm] | --bug | --closes | --tag | --message) + -c | --closes) + local resolutions=( + fixed + obsolete + pkgremoved + ) + + local bug="${cur%:*}" + if [[ ${bug} != ${cur} && ${bug} != http?(s) ]]; then + local bugres="${resolutions[*]/#/${bug}:}" + COMPREPLY=($(compgen -W "${bugres}" -- "${cur}")) + _comp_ltrim_colon_completions "$cur" + else + COMPREPLY=() + fi + ;; + -[bTm] | --bug | --tag | --message) COMPREPLY=() ;; -M | --message-template) -- cgit v1.2.3-65-gdbad