[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-387-gb13ee01

Igor Murzov e-mail at date.by
Sun Jun 26 00:08:11 UTC 2011


The following commit has been merged in the master branch:
commit b13ee019d0eed45107aefdbe550c52aaef2bcc93
Author: Igor Murzov <e-mail at date.by>
Date:   Sun Jun 26 03:38:20 2011 +0400

    make completions that use _command also work with file names

diff --git a/bash_completion b/bash_completion
index 819899e..e5577e3 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1581,8 +1581,9 @@ _command_offset()
     _get_comp_words_by_ref cur
 
     if [[ $COMP_CWORD -eq 0 ]]; then
+        local IFS=$'\n'
         compopt -o filenames
-        COMPREPLY=( $( compgen -c -- "$cur" ) )
+        COMPREPLY=( $( compgen -d -c -- "$cur" ) )
     else
         cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]}
         # Do we have full path completion for $cmd?
diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp
index 3bed4fd..d052458 100644
--- a/test/lib/completions/time.exp
+++ b/test/lib/completions/time.exp
@@ -4,7 +4,7 @@ proc setup {} {
 
 
 proc teardown {} {
-    assert_env_unmodified
+    assert_env_unmodified {/OLDPWD=/d}
 }
 
 
@@ -17,4 +17,20 @@ assert_complete_any "time set"
 sync_after_int
 
 
+set test "-p find -typ should complete find's options"
+assert_complete "-type" "time -p find -typ" $test
+
+
+sync_after_int
+
+
+set test "it should be possible to complete file paths"
+set dir $::srcdir/fixtures/shared
+set files [split [exec bash -c "cd $dir/bin && ls -p"] "\n"]
+assert_complete_dir $files "time ./bin/" $dir $test
+
+
+sync_after_int
+
+
 teardown

-- 
bash-completion



More information about the Bash-completion-commits mailing list