diff options
Diffstat (limited to 'completions/reportbug')
-rw-r--r-- | completions/reportbug | 94 |
1 files changed, 37 insertions, 57 deletions
diff --git a/completions/reportbug b/completions/reportbug index 69b12e9..30c4647 100644 --- a/completions/reportbug +++ b/completions/reportbug @@ -1,96 +1,76 @@ # bash completion for (Debian) reportbug -*- shell-script -*- -_reportbug() +_comp_cmd_reportbug() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return + local noargopts='!(-*|*[CefKHPsoiATjVuQtBS]*)' + # shellcheck disable=SC2254 case $prev in - --class | --header | --pseudo-header | --mirror | --list-cc | --subject | \ - --http_proxy | --proxy | --email | --realname | --smtpuser | --smtppasswd | \ - --replyto | --reply-to | --justification | --package-version | --body | \ - --body-file | --timeout | --max-attachment-size | --envelope-from | \ - -!(-*)[CHPsjV]) + --class | --header | --pseudo-header | --mirror | --list-cc | \ + --subject | --http_proxy | --proxy | --email | --realname | \ + --smtpuser | --smtppasswd | --replyto | --reply-to | \ + --justification | --package-version | --body | --body-file | \ + --timeout | --max-attachment-size | --envelope-from | \ + -${noargopts}[CHPsjV]) return ;; --filename | --include | --mta | --output | --attach | -[fioA]) - _filedir + _comp_compgen_filedir return ;; - --keyid | -!(-*)K) - COMPREPLY=($(compgen -W '$(IFS=: ; \ - gpg --list-keys --with-colons 2>/dev/null \ - | while read -ra row ; do - [[ "${row[0]}" == [ps]ub && ${row[11]} == *s* ]] && \ - printf "%s\n" "${row[4]}" - done)' -- "$cur")) + --keyid | -${noargopts}K) + _comp_compgen_split -- "$( + IFS=: + gpg --list-keys --with-colons 2>/dev/null | + while read -ra row; do + [[ ${row[0]} == [ps]ub && ${row[11]} == *s* ]] && + printf '%s\n' "${row[4]}" + done + )" return ;; - --bts | -!(-*)B) - COMPREPLY=($(compgen -W "debian guug kde mandrake help" -- \ - "$cur")) + --tag | --ui | --interface | --type | --bts | --severity | --mode | -${noargopts}[TutBS]) + _comp_compgen_split -- "$("$1" "$prev" help 2>&1 | + command sed -ne '/^[[:space:]]/p')" return ;; - --editor | --mua | --mbox-reader-cmd | -!(-*)e) - compopt -o filenames - COMPREPLY=($(compgen -c -- "$cur")) - return - ;; - --mode) - COMPREPLY=($(compgen -W "novice standard expert" -- "$cur")) - return - ;; - --severity | -!(-*)S) - COMPREPLY=($(compgen -W "grave serious important normal minor - wishlist" -- "$cur")) - return - ;; - --ui | --interface | -!(-*)u) - COMPREPLY=($(compgen -W "newt text gnome" -- "$cur")) - return - ;; - --type | -!(-*)t) - COMPREPLY=($(compgen -W "gnats debbugs" -- "$cur")) - return - ;; - --tag | -!(-*)T) - COMPREPLY=($(compgen -W "none woody potato sarge sarge-ignore - etch etch-ignore lenny lenny-ignore sid experimental confirmed - d-i fixed fixed-in-experimental fixed-upstream help l10n - moreinfo patch pending security unreproducible upstream wontfix - ipv6 lfs" -- "$cur")) + --editor | --mua | --mbox-reader-cmd | -${noargopts}e) + _comp_compgen_commands return ;; --from-buildd) - COMPREPLY=($(compgen -S "_" -W '$(apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" ")')) + _comp_compgen_split -S "_" -- "$(apt-cache dumpavail | + _comp_awk -F ' ' '$1 == "Source:" && !uniq[$2]++ { print $2 }')" return ;; --smtphost) - _known_hosts_real -- "$cur" + _comp_compgen_known_hosts -- "$cur" return ;; --draftpath) - _filedir -d + _comp_compgen_filedir -d return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + _comp_compgen_help [[ ${COMPREPLY-} == -*= ]] && compopt -o nospace return fi - COMPREPLY=($(compgen -W 'wnpp boot-floppies kernel bugs.debian.org + _comp_compgen -- -W 'wnpp boot-floppies kernel bugs.debian.org cdimage.debian.org general installation-reports listarchives lists.debian.org mirrors nm.debian.org press project qa.debian.org release-notes security.debian.org tech-ctte upgrade-reports - www.debian.org $(_xfunc apt-cache _apt_cache_packages)' -- "$cur")) - _filedir + www.debian.org' + _comp_compgen -ax apt-cache packages + _comp_compgen -a filedir } && - complete -F _reportbug reportbug + complete -F _comp_cmd_reportbug reportbug # ex: filetype=sh |