Package: deborphan
Version: 1.7.16
Severity: wishlist
Tags: patch

the attached file needs to end up in /etc/bash_completion.d/

Please include it in one of the next releases.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-686
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages deborphan depends on:
ii  bash                      3.0-15         The GNU Bourne Again SHell
ii  dialog                    1.0-20050306-1 Displays user-friendly dialog boxe
ii  gettext-base              0.14.5-2       GNU Internationalization utilities
ii  libc6                     2.3.2.ds1-22   GNU C Library: Shared libraries an

Versions of packages deborphan recommends:
ii  apt                           0.6.38     Advanced front-end for dpkg

-- no debconf information
have deborphan &&
_deborphan()
{

  local last_item_in_list 
  local cur=$2 prev=$3
  local options='--help -h --version -v --status-file -f 
    --show-deps -d --show-priority -P --show-size -z 
    --show-section -s --no-show-section --nice-mode -n 
    --all-packages -a --libdevel --exclude -e --priority -p 
    --force-hold -H --find-config --add-keep -A --del-keep -R 
    --list-keep -L --zero-keep -Z --keep-file -k 
    --guess-perl --guess-python --guess-pike 
    --guess-ruby --guess-interpreters
    --guess-section --guess-dev --guess-debug
    --guess-common --guess-data --guess-doc --guess-dummy
    --guess-all --guess-only
    '
 
  COMPREPLY=()
 
  case "$prev" in 
    # previous option asks for a file
    -@(-status-file|f|-keep-file|k))
      _filedir
      return 0
      ;;
    # previous option asks for a package or "-"
    # if there's more than 1 package listed, use the default below
    # for package completion
    # could maybe use /var/lib/deborphan/keep for -R|--del-keep
    # but tricky if -f|--status-file is given
    -@(-add-keep|A|-del-keep|R))
      COMPREPLY=( $( compgen -W "$( _comp_dpkg_installed_packages $cur ) -" -- 
$cur ) )
      return 0
      ;;
    # previous option asks for a priority
    -@(-priority|p))
      COMPREPLY=( $( compgen -W '1 2 3 4 5 required important standard optional 
extra' -- $cur) )
      return 0
      ;;
    # previous option asks for a commaseparated list of packages
    -@(-exclude|e))
      last_item_in_list="${cur##*,}"
      list_before_item="${cur%$last_item_in_list}"
      #add "," to the list and take care of already existing listed packages
      COMPREPLY=(
                  $( 
                   compgen -S "," -P "$list_before_item" -W "$( 
_comp_dpkg_installed_packages $last_item_in_list )"
                  )
                )

      return 0
      ;;
  esac

        if [[ "$cur" == -* ]]; then
                # return one of the possible options
    COMPREPLY=( $( compgen -W "$options" -- $cur ) )
        else
          # return matching installed packages
    # (default and for -A or -R package list    
    COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
        fi

  return 0
}
[ -n "${have:-}" ] && complete -F _deborphan $filenames deborphan

Reply via email to