Package: apt-file
Version: 2.0.3-7
Severity: wishlist

Place attached file into /etc/bash_completion.d/apt-file, please. It will
allow bash to make user-friendly complitions.

Thank you.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (999, 'testing'), (50, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-686-smp
Locale: LANG=en_US.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)

Versions of packages apt-file depends on:
ii  gzip                          1.3.5-9    The GNU compression utility
ii  libapt-pkg-perl               0.1.13     Perl interface to libapt-pkg
ii  libconfigfile-perl            1.1.1      Parses simple configuration files
ii  perl                          5.8.4-8    Larry Wall's Practical Extraction 

-- no debconf information
have apt-file &&
_apt-file()
{
        local cur prev special i

        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
        prev=${COMP_WORDS[COMP_CWORD-1]}

        for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
                if [[ ${COMP_WORDS[i]} == @(list) ]]; then
                        special=${COMP_WORDS[i]}
                fi
        done

        if [ -n "$special" ]; then
            COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
            return 0
        fi

        if [[ "$cur" == -* ]]; then

                COMPREPLY=( $( compgen -W '-c -v -V -a -s -l -F -y -H \
                                --cache --verbose --version --architecture \
                                --sources-list --package-only --fixed-string \
                                --dummy --help' -- $cur ) )
        else

                COMPREPLY=( $( compgen -W 'update search list \
                                purge' -- $cur ) )

        fi


        return 0

}
complete -F _apt-file apt-file

Reply via email to