[Bash-completion-commits] [SCM] bash-completion branch, master, updated. c5470fdf742c34b79fb037f906921f2d5fc71082

Ville Skyttä ville.skytta at iki.fi
Sat Jan 30 10:45:10 UTC 2010


The following commit has been merged in the master branch:
commit c5470fdf742c34b79fb037f906921f2d5fc71082
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Jan 30 12:41:54 2010 +0200

    Simplify java classes-in-classpath-dirs completion.
    
    We intentionally don't look into subdirs of dirs in classpath
    (Debian: #496828) so a plain "ls" instead of "find" with non-portable
    -maxdepth is fine.

diff --git a/contrib/java b/contrib/java
index cbd29f1..b9418ed 100644
--- a/contrib/java
+++ b/contrib/java
@@ -71,12 +71,11 @@ _java_classes()
             fi
 
         elif [ -d $i ]; then
-            i=${i%/}
-
-            # See Debian bug #496828
-            COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
-                -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
-                command grep -v "\\$" | sed -e "s|^$i/||" ) )
+            # Intentionally looking for *.class only in $i (not subdirs),
+            # see Debian bug #496828.
+            COMPREPLY=( "${COMPREPLY[@]}"
+                $( command ls $i/$cur*.class 2>/dev/null | \
+                    sed -ne '/\$/d' -e "s|^$i//*||p" ) )
 
             # FIXME: if we have foo.class and foo/, the completion
             # returns "foo/"... how to give precedence to files

-- 
bash-completion



More information about the Bash-completion-commits mailing list