From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24762 invoked by alias); 14 Nov 2010 20:38:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28414 Received: (qmail 22910 invoked from network); 14 Nov 2010 20:37:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at zsh.org does not designate permitted sender hosts) Date: Sun, 14 Nov 2010 20:41:40 +0000 From: Clint Adams To: zsh-workers@zsh.org Cc: Ansgar Burchardt , 538090@bugs.debian.org Subject: Re: Bug#538090: completion: reportbug also accepts filenames Message-ID: <20101114204140.GA13563@scru.org> References: <20090722234917.5047.46019.reportbug@marvin.43-1.org> <20090723014702.GA15115@scru.org> <87r5w8gma8.fsf@marvin.43-1.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r5w8gma8.fsf@marvin.43-1.org> User-Agent: Mutt/1.5.18 (2008-05-17) 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