From b556b22d8717e8c9d547f07aebc8c902ea22af3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 15 Apr 2009 00:09:33 +0300 Subject: [PATCH] Do not assume all --foo= options take filenames in generic long option completion, assume only that --*file*= does, and that --*dir*= takes dirs. --- CHANGES | 2 ++ bash_completion | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e7fd5637..b856e17e 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,8 @@ bash-completion (1.x) generic long option completion. * Add chown --from and --reference value completions. * Add chgrp --reference value completion. + * Do not assume all --foo= options take filenames in generic long option + completion, assume only that --*file*= does, and that --*dir*= takes dirs. [ Todd Zullinger ] * Make yum complete on filenames after install, deplist, update and upgrade diff --git a/bash_completion b/bash_completion index d3318684..2bd71148 100644 --- a/bash_completion +++ b/bash_completion @@ -4300,7 +4300,14 @@ _longopt() prev=${COMP_WORDS[COMP_CWORD-1]} if _split_longopt; then - _filedir + case "$prev" in + *[Dd][Ii][Rr]*) + _filedir -d + ;; + *[Ff][Ii][Ll][Ee]*) + _filedir + ;; + esac return 0 fi