Package: devscripts
Version: 2.10.64
Severity: minor
Tags: patch
User: [email protected]
Usertags: debc

The bash completion script for debc only completes to package names, not
.changes files. This in very irritating because one can't tab-complete
/var/cache/pbuilder/sid-amd64/results/foo.changes (rather a mouthful to
type longhand).

I've never written a bash completion script before, but here's something
that works well for me.

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  H: +27 21 465 6908 C: +27 72 419 8559  UCT: x3127
diff --git a/scripts/pkgnames.bash_completion b/scripts/pkgnames.bash_completion
index 1486eb8..8a8f98e 100644
--- a/scripts/pkgnames.bash_completion
+++ b/scripts/pkgnames.bash_completion
@@ -8,5 +8,16 @@ _pkg_names()
 
     return 0
 }
-complete -F _pkg_names wnpp-alert wnpp-check mk-build-deps rmadison mass-bug debsnap dd-list build-rdeps who-uploads transition-check getbuildlog dcontrol grep-excuses rc-alert debcheckout bts whodepends dget pts-subscribe debc pts-unsubscribe
 
+_debc()
+{
+    local cur
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    COMPREPLY=($(compgen -f -X '!*.changes' -- "$cur"))
+    if echo "$cur" | grep -qs '^[a-z0-9+.-]*$'; then
+        COMPREPLY=(${comprep...@]} $(apt-cache pkgnames -- $cur 2> /dev/null))
+    fi
+    return 0
+}
+complete -F _pkg_names wnpp-alert wnpp-check mk-build-deps rmadison mass-bug debsnap dd-list build-rdeps who-uploads transition-check getbuildlog dcontrol grep-excuses rc-alert bts whodepends dget pts-subscribe debc pts-unsubscribe
+complete -o dirnames -F _debc debc

Attachment: signature.asc
Description: Digital signature

Reply via email to