Bug#969389: debsums: Add bash completion

Reuben Thomas rrt at sc3d.org
Tue Sep 1 18:27:49 BST 2020


Package: debsums
Version: 2.2.5
Severity: wishlist
Tags: patch

Here are bash completions for debsums. The implementation of
_comp_dpkg_installed_packages() is from dpkg’s bash completions; I don’t
know whether there’s a way to share them? Or, since
/usr/share/bash-completion/completions/dpkg is in the bash-completion
package, perhaps this bug would be better filed there?

_have grep-status && {
_comp_dpkg_installed_packages()
{
    grep-status -P -e "^$1" -a -FStatus 'ok installed' -n -s Package
}
} || {
_comp_dpkg_installed_packages()
{
    command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | \
        command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
            half-configured" \
            -Ee "^Essential: yes" | \
        awk "/Package: $1/ { print \$2 }" 2>/dev/null
}
}

_debsums()
{
    local cur prev words cword
    _init_completion || return

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
    else
        COMPREPLY=( $(_comp_dpkg_installed_packages "$cur") )
    fi
} &&
complete -F _debsums -o default debsums

-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), (100, 'focal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-42-generic (SMP w/16 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debsums depends on:
ii  libdpkg-perl          1.19.7ubuntu3
ii  libfile-fnmatch-perl  0.02-2build6
ii  perl                  5.30.0-9build1
ii  ucf                   3.0038+nmu1

debsums recommends no packages.

debsums suggests no packages.

-- Configuration Files:
/etc/debsums-ignore [Errno 2] No such file or directory: '/etc/debsums-ignore'

-- no debconf information


More information about the pkg-perl-maintainers mailing list