[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-114-ga0afe09

Ville Skyttä ville.skytta at iki.fi
Sun Apr 24 17:23:41 UTC 2011


The following commit has been merged in the master branch:
commit a87086b7d46d7972059a00251967a1f1fff33205
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 19:54:50 2011 +0300

    Turn off default compopt when completing dirs in _longopt().
    
    Otherwise -o default kicks in in cases where we have no dir
    completions and ends up completing files.

diff --git a/CHANGES b/CHANGES
index 321e4f8..de85d67 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,7 +2,8 @@ bash-completion (2.x)
 
   [ Ville Skyttä ]
   * Add pxz and reptyr completions.
-  * Improve aspell, gendiff, rsync, smartctl, tar, xz, and xzdec completions.
+  * Improve aspell, gendiff, rsync, smartctl, tar, xz, xzdec, and generic long
+    option completions.
   * Try harder to find the correct perl executable to run the perl helper with.
   * Drop rpm query support for rpm < 4.1.
   * Split rpm and rpmbuild completions and improve them both.
diff --git a/bash_completion b/bash_completion
index cc3bf3d..4ddae7c 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1604,6 +1604,7 @@ _longopt()
 
     case "$prev" in
         --*[Dd][Ii][Rr]*)
+            compopt +o default
             _filedir -d
             return 0
             ;;
@@ -1620,6 +1621,7 @@ _longopt()
             sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
             -- "$cur" ) )
     elif [[ "$1" == @(mk|rm)dir ]]; then
+        compopt +o default
         _filedir -d
     else
         _filedir
diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp
index 8d8c881..44e87ce 100644
--- a/test/lib/completions/mkdir.exp
+++ b/test/lib/completions/mkdir.exp
@@ -23,4 +23,11 @@ assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/"
 sync_after_int
 
 
+# No subdirs in foo.d and should not complete files in it (_longopt()).
+assert_no_complete "mkdir $::srcdir/fixtures/shared/default/foo.d/"
+
+
+sync_after_int
+
+
 teardown

-- 
bash-completion



More information about the Bash-completion-commits mailing list