about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-03-05 14:49:47 +0000
committerPeter Stephenson <pws@zsh.org>2015-03-05 14:49:47 +0000
commitec03a233c5b1ae0256f00bfa6bf19d406d860d33 (patch)
treef3a5fff90fdb9d437761b5abade570ecbfd06dcb
parent506eaa0a638c72f215fb0afa0b8172a43592af5b (diff)
downloadzsh-ec03a233c5b1ae0256f00bfa6bf19d406d860d33.tar.gz
zsh-ec03a233c5b1ae0256f00bfa6bf19d406d860d33.tar.xz
zsh-ec03a233c5b1ae0256f00bfa6bf19d406d860d33.zip
34654: Improved rpm -q --whatprovides completion
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Redhat/Command/_rpm11
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d8b2162ac..74295288f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-03-05  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 34654: Completion/Redhat/Command/_rpm: complete absolute file
+	names after -q --whatprovides.
+
 	* 34651: Src/lex.c: avoid core dump if no lexical token.
 
 	* Daniel Shahaf: 34647: Completion/Zsh/Function/_add-zsh-hook:
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index 696c12fa3..b2157bd48 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;