zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Allow ''yum install'' to complete local files
@ 2015-05-25 18:19 Eric Cook
  0 siblings, 0 replies; only message in thread
From: Eric Cook @ 2015-05-25 18:19 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Redhat/Command/_yum | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum
index a698328..f453806 100644
--- a/Completion/Redhat/Command/_yum
+++ b/Completion/Redhat/Command/_yum
@@ -173,20 +173,34 @@ yum_repos() {
 # Completion function for install
 (( $+functions[_yum_install] )) || _yum_install()
 {
-	_yum_available_pkgs
-	compadd "$@" -a -- _available_pkgs
+        if ! [[ $PREFIX == */* ]]; then
+          _yum_available_pkgs
+        fi
+
+        local ret=1
+        _tags files packages
+        while _tags; do
+          if _requested files; then
+            compadd "$@" -a -- _available_pkgs
+          fi
+          if _requested packages; then
+            _call_function - _yum_localinstall
+          fi
+          (( ret )) || break
+        done
+        return ret
 }
 
 # Completion function for localinstall
 (( $+functions[_yum_localinstall] )) || _yum_localinstall()
 {
-	_files -g '(#i)*.rpm(-.)'
+	_files -/ -g '(#i)*.rpm(-.)'
 }
 
 # Completion function for localupdate
 (( $+functions[_yum_localupdate] )) || _yum_localupdate()
 {
-	_files -g '(#i)*.rpm(-.)'
+	_files -/ -g '(#i)*.rpm(-.)'
 }
 
 # Completion function for update/upgrade
-- 
2.3.7


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-25 18:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-25 18:19 [PATCH] Allow ''yum install'' to complete local files Eric Cook

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).