[Bash-completion-devel] [PATCH] yum: Complete on filenames when $cur contains /

Todd Zullinger tmz at pobox.com
Wed Apr 1 19:56:09 UTC 2009


For a long time "yum install" has accepted filenames as input and will
do the same thing that "yum localinstall" does.  Many users no longer
bother using localinstall and then find that they cannot complete a
pathname with yum install.  Similarly, deplist, update, and upgrade
accept filenames.
---

Greetings,

I whipped this up in response to some discussion in #fedora-devel the
other day, noting that it was not possible to complete on filenames
using bash-completion's yum function.  This isn't perfect, but it does
at least allow for filename completion when the user has explicitly
started to type a path.

If you'd prefer patches in another form or place, please let me know.
This patch is meant to apply with git am, to master.  I can rebase it
to the 1.x branch if that's preferable.

 contrib/yum |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/contrib/yum b/contrib/yum
index e5af2d3..70ca365 100644
--- a/contrib/yum
+++ b/contrib/yum
@@ -43,6 +43,10 @@ _yum()
 	done
 
 	if [ -n "$special" ]; then
+		if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
+			_filedir rpm
+			return 0
+		fi
 		case $special in
 			install)
 				_yum_list available
-- 
1.6.2.1

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chemistry is applied theology.
    -- Augustus Owsley Stanley




More information about the Bash-completion-devel mailing list