Bug#799545: apt: bash command line completion missing for apt-mark
Package: apt
Version: 1.0.10.2
Severity: wishlist
Tags: patch
Dear Maintainer,
find attached a bash completion file for apt-mark.
Regards,
Michail Bachmann
-- Package-specific info:
-- (/etc/apt/preferences present, but not submitted) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable'), (300, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 4.1.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages apt depends on:
ii debian-archive-keyring 2014.3
ii gnupg 1.4.19-5
ii libapt-pkg4.16 1.0.10.2
ii libc6 2.19-20
ii libgcc1 1:5.2.1-17
ii libstdc++6 5.2.1-17
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none>
ii aptitude 0.7.2-1
ii dpkg-dev 1.18.2
ii python-apt 1.0.0
-- no debconf information
# Debian apt-mark(8) completion -*- shell-script -*-
_apt_mark()
{
local cur prev words
_init_completion || return
local special i
for (( i=0; i < ${#words[@]}-1; i++ )); do
if [[ ${words[i]} == @(auto|manual|hold|unhold|showauto|showmanual|showhold) ]]; then
special=${words[i]}
fi
done
if [[ -n $special ]]; then
case $special in
auto)
COMPREPLY=( \
$([ -z "$cur" ] && apt-mark showmanual) \
$([ -n "$cur" ] && apt-mark showmanual | command egrep ^"$cur") \
)
return 0
;;
manual)
COMPREPLY=( \
$([ -z "$cur" ] && apt-mark showauto) \
$([ -n "$cur" ] && apt-mark showauto | command egrep ^"$cur") \
)
return 0
;;
unhold)
COMPREPLY=( \
$([ -z "$cur" ] && apt-mark showhold) \
$([ -n "$cur" ] && apt-mark showhold | command egrep ^"$cur") \
)
return 0
;;
hold)
COMPREPLY=( \
$( _xfunc dpkg _comp_dpkg_installed_packages $cur | \
grep -v -f <(apt-mark showhold | xargs -n1 -I{} echo ^{}) ) \
)
return 0
;;
esac
fi
case $prev in
-c|-f)
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -q -qq -s -f -c -o' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'auto manual hold unhold showauto showmanual showhold' -- "$cur" ) )
fi
return 0
} &&
complete -F _apt_mark apt-mark
# ex: ts=4 sw=4 et filetype=sh
Reply to: