Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: complete after rpm -q --whatprovides
- X-seq: zsh-workers 34654
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Subject: PATCH: complete after rpm -q --whatprovides
- Date: Thu, 05 Mar 2015 14:37:47 +0000
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
Long standing gripes that act as displacement activities, latest in a
series.
The rpm manual page says "rpm -q --whatprovides" queries a CAPABILITY.
It neglects to say what a CAPABILITY actually is, but files certainly
work as well as packages. Using a package is supported, but as far as I
can see the "--whatprovides" is then redundant.
As only absolute paths to files work (I've tested this), I've used the
leading / as a discriminator --- otherwise completion is really slow
because it needs to compile a package list, which is a waste of time for
files.
pws
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index 696c12f..d5e55c1 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -32,6 +32,8 @@
# complete a RPM package file name
# package_or_file
# the previous two together
+# file_or_package
+# an absolute path to any file (not a package file) or a package
# tags
# complete a tag name
# capability
@@ -66,7 +68,7 @@ _rpm () {
{-g,--group}'[query packages in one of specified groups]'
--fileid --hdrid --pkgid --tid --querybynumber
'--triggeredby'
- '--whatprovides'
+ '--whatprovides:*:provided file:->file_or_package'
'--whatrequires'
)
sopts=${selectopts%\[*}\ --specfile
@@ -246,6 +248,13 @@ _rpm () {
package_or_file)
state=package_file
;;
+ file_or_package)
+ if [[ $PREFIX = /* ]]; then
+ _wanted files expl 'file' _files
+ else
+ state=package
+ fi
+ ;;
package)
if ( [[ ${+_rpms} -eq 0 ]] || _cache_invalid RPMs ) &&
! _retrieve_cache RPMs;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author