summaryrefslogtreecommitdiffstats
path: root/completions/bts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
commit6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch)
tree0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/bts
parentReleasing progress-linux version 1:2.11-8~progress7.99u1. (diff)
downloadbash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz
bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/bts')
-rw-r--r--completions/bts96
1 files changed, 50 insertions, 46 deletions
diff --git a/completions/bts b/completions/bts
index d535d13..e4f8079 100644
--- a/completions/bts
+++ b/completions/bts
@@ -1,81 +1,85 @@
-# bts completion -*- shell-script -*-
+# bts completion -*- shell-script -*-
-# List bug numbers from bugs cache in ~/.devscripts_cache/bts
-_cached_bugs()
+# Generate bug numbers from bugs cache in ~/.devscripts_cache/bts
+_comp_cmd_bts__compgen_cached_bugs()
{
- [[ -d $HOME/.devscripts_cache/bts ]] &&
- find $HOME/.devscripts_cache/bts -maxdepth 1 -name "${cur}[0-9]*.html" \
+ [[ -d $HOME/.devscripts_cache/bts ]] || return 1
+ local bugs=$(
+ find "$HOME/.devscripts_cache/bts" -maxdepth 1 \
+ -name "${cur}[0-9]*.html" \
-printf "%f\n" | cut -d'.' -f1
+ )
+ _comp_compgen -RU bugs -- -W '$bugs'
}
-# List APT source packages prefixed with "src:"
-_src_packages_with_prefix()
+# Generate APT source packages prefixed with "src:"
+_comp_cmd_bts__compgen_src_packages_with_prefix()
{
- ppn=${cur:4} # partial package name, after stripping "src:"
- compgen -P "src:" -W '$(_xfunc apt-cache _apt_cache_sources "$ppn")' \
- -- "$ppn"
+ local _ppn=${cur:4} # partial package name, after stripping "src:"
+ local sources
+ _comp_compgen -v sources -c "$_ppn" -x apt-cache sources &&
+ _comp_compgen -U sources -- -P "src:" -W '"${sources[@]}"'
}
-_bts()
+_comp_cmd_bts()
{
- local cur prev words cword split
- _init_completion -s || return
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
case $prev in
show | bugs)
- COMPREPLY=($(compgen -W 'release-critical RC from: tag:
- usertag:' -- "$cur") $(_cached_bugs)
- $(_src_packages_with_prefix))
+ _comp_compgen -- -W 'release-critical RC from: tag: usertag:'
+ _comp_compgen -ai bts cached_bugs
+ _comp_compgen -ai bts src_packages_with_prefix
return
;;
select)
- COMPREPLY=($(compgen -W 'package: source: maintainer: submitter:
+ _comp_compgen -- -W 'package: source: maintainer: submitter:
severity: status: tag: owner: correspondent: affects: bugs:
- users: archive:' -- "$cur"))
+ users: archive:'
return
;;
status)
- COMPREPLY=($(compgen -W 'file: fields: verbose' -- "$cur")
- $(_cached_bugs))
+ _comp_compgen -- -W 'file: fields: verbose'
+ _comp_compgen -ai bts cached_bugs
return
;;
block | unblock)
- COMPREPLY=($(compgen -W 'by with' -- "$cur"))
+ _comp_compgen -- -W 'by with'
return
;;
severity)
- COMPREPLY=($(compgen -W 'wishlist minor normal important serious
- grave critical' -- "$cur"))
+ _comp_compgen -- -W 'wishlist minor normal important serious grave
+ critical'
return
;;
limit)
- COMPREPLY=($(compgen -W 'submitter date subject msgid package
- source tag severity owner affects archive' -- "$cur"))
+ _comp_compgen -- -W 'submitter date subject msgid package source
+ tag severity owner affects archive'
return
;;
clone | "done" | reopen | archive | unarchive | retitle | summary | submitter | found | notfound | fixed | notfixed | merge | forcemerge | unmerge | claim | unclaim | forwarded | notforwarded | owner | noowner | subscribe | unsubscribe | reportspam | spamreport | affects | usertag | usertags | reassign | tag | tags)
- COMPREPLY=($(_cached_bugs))
+ _comp_compgen -i bts cached_bugs
return
;;
package)
- COMPREPLY=($(_xfunc apt-cache _apt_cache_packages))
+ _comp_compgen -x apt-cache packages
return
;;
cache)
- COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)
- $(_src_packages_with_prefix)
- $(compgen -W 'from: release-critical RC' -- "$cur"))
+ _comp_compgen -x apt-cache packages
+ _comp_compgen -ai bts src_packages_with_prefix
+ _comp_compgen -a -- -W 'from: release-critical RC'
return
;;
cleancache)
- COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)
- $(_src_packages_with_prefix)
- $(compgen -W 'from: tag: usertag: ALL' -- "$cur"))
+ _comp_compgen -x apt-cache packages
+ _comp_compgen -ai bts src_packages_with_prefix
+ _comp_compgen -a -- -W 'from: tag: usertag: ALL'
return
;;
user)
# non-predicible arguments
- COMPREPLY=()
return
;;
:)
@@ -83,30 +87,30 @@ _bts()
# COMP_WORDS would be: "bts cleancache src : <partial_pkg_name>"
pos=$((COMP_CWORD - 2))
if [[ $pos -gt 0 && ${COMP_WORDS[pos]} == "src" ]]; then
- COMPREPLY=($(_xfunc apt-cache _apt_cache_src_packages))
+ _comp_compgen -x apt-cache sources
+
return
fi
;;
esac
- $split && return
+ [[ $was_split ]] && return
- COMPREPLY=($(compgen -W '--offline --online --no-offline
- --no-action --cache --no-cache --cache-mode --cache-delay --mbox
- --mailreader --cc-addr --use-default-cc --no-use-default-cc
- --sendmail --mutt --no-mutt --smtp-host --smtp-username
- --smtp-helo --bts-server --force-refresh --no-force-refresh
- --only-new --include-resolved --no-include-resolved --no-ack --ack
- --interactive --force-interactive --no-interactive --quiet
- --no-conf --noconf
+ _comp_compgen -- -W '--offline --online --no-offline --no-action --cache
+ --no-cache --cache-mode --cache-delay --mbox --mailreader --cc-addr
+ --use-default-cc --no-use-default-cc --sendmail --mutt --no-mutt
+ --smtp-host --smtp-username --smtp-helo --bts-server --force-refresh
+ --no-force-refresh --only-new --include-resolved --no-include-resolved
+ --no-ack --ack --interactive --force-interactive --no-interactive
+ --quiet --no-conf --noconf
show bugs select status clone done reopen archive unarchive retitle
summary submitter reassign found notfound fixed notfixed block unblock
merge forcemerge unmerge tag tags affects user usertag usertags claim
unclaim severity forwarded notforwarded package limit owner noowner
subscribe unsubscribe reportspam spamreport cache cleancache version
- help' -- "$cur"))
+ help'
} &&
- complete -F _bts bts
+ complete -F _comp_cmd_bts bts
# ex: filetype=sh