Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#538090: completion: reportbug also accepts filenames



On Thu, Jul 23, 2009 at 04:34:23AM +0200, Ansgar Burchardt wrote:
> > And it should only offer the filenames if you've already typed something
> > beginning with a slash?
> 
> Yes, that would be perfect.  From the man page:
> 
>     You may specify either a package name or an absolute filename; if
>     you use a filename, it must begin with a / to be recognized.

Index: Completion/Debian/Command/_bug
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/Command/_bug,v
retrieving revision 1.7
diff -u -r1.7 _bug
--- Completion/Debian/Command/_bug	10 Dec 2009 20:49:39 -0000	1.7
+++ Completion/Debian/Command/_bug	14 Nov 2010 20:36:44 -0000
@@ -1,5 +1,6 @@
 #compdef bug reportbug querybts
 
+local expl
 local _bug_commonargs _rb_commonargs
 
 _bug_commonargs=(
@@ -7,7 +8,7 @@
   '-m[maintainer-only]'
   '-p[print to stdout instead of mail]'
   '-h[help]'
-  '*:package:_deb_packages installed'
+  '*:packageorfile:->pkgorfile'
 )
 
 _rb_commonargs=(
@@ -29,7 +30,7 @@
       '-v[version]' \
       '-x[do not cc submitter]' \
       '-z[send configs verbatim]' \
-      "$_bug_commonargs[@]"
+      "$_bug_commonargs[@]" && return
   ;;
   reportbug)
     _arguments \
@@ -93,7 +94,7 @@
       '--body=:message body string' \
       '--body-file=:message body file:_files' \
       "$_bug_commonargs[@]" \
-      "$_rb_commonargs[@]"
+      "$_rb_commonargs[@]" && return
   ;;
   querybts)
     _arguments \
@@ -102,6 +103,15 @@
       '(-s --source)'{-s,--source}'[query for source packages rather than binary]' \
       '(-v --version)'{-v,--version}'[show version]' \
       "$_rb_commonargs[@]" \
-      '*:package:_deb_packages avail'
+      '*:package:_deb_packages avail' && return
   ;;
 esac
+
+case "$service:$state:${words[CURRENT]}" in
+	(reportbug:pkgorfile:/*)
+	  _wanted tag expl 'file' _files
+	;;
+	(reportbug:pkgorfile:*)
+  	  _wanted tax expl 'package' _deb_packages installed
+	;;
+esac



Messages sorted by: Reverse Date, Date, Thread, Author