Package: apt-file
Version: 2.0.8.2
Severity: normal
Tags: patch

After entering 'apt-file search' completion suggests a list of actions
instead of file names.

I've modified completion script and it works fine for me.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.21-1-686 (SMP w/1 CPU core)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt-file depends on:
ii  curl                          7.17.0-1   Get a file from an HTTP, HTTPS or 
ii  gzip                          1.3.12-3.2 The GNU compression utility
ii  libapt-pkg-perl               0.1.21+b1  Perl interface to libapt-pkg
ii  libconfig-file-perl           1.41-1     Parses simple configuration files
ii  perl                          5.8.8-11.1 Larry Wall's Practical Extraction 
ii  wget                          1.10.2-3   retrieves files from the web

apt-file recommends no packages.

-- no debconf information

-- 
Dmitry
--- apt-file.orig	2007-10-28 15:45:12.000000000 +0300
+++ apt-file	2007-10-28 15:51:33.000000000 +0300
@@ -8,32 +8,34 @@
 	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
+		case ${COMP_WORDS[i]} in
+		    update|search|list|show|purge)
+		        special=${COMP_WORDS[i]}
+			break
+			;;
+		esac
 	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 ) )
+	elif [ -n "$special" ]; then
+		case $special in
+		    list|show)
+			COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
+			;;
+		    search)
+			_filedir
+			;;
+		esac
 	else
 
 		COMPREPLY=( $( compgen -W 'update search list \
                                 show purge' -- $cur ) )
 
 	fi
-
-
-	return 0
-
 }
-complete -F _apt-file apt-file
-
+complete -F _apt-file $filenames apt-file

Attachment: signature.asc
Description: Digital signature

Reply via email to