[PATCH] improved java completion

Mattias Ulbrich ulbrich at kit.edu
Thu Mar 24 17:16:28 UTC 2011


now suggests also package names
---
 completions/java |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/completions/java b/completions/java
index 460ae28..4e0ae9c 100644
--- a/completions/java
+++ b/completions/java
@@ -72,11 +72,11 @@ _java_classes()
             fi
 
         elif [ -d $i ]; then
-            # Intentionally looking for *.class only in $i (not subdirs),
-            # see Debian bug #496828.
+            compopt -o nospace
             COMPREPLY=( "${COMPREPLY[@]}"
-                $( command ls $i/$cur*.class 2>/dev/null | \
-                    sed -ne '/\$/d' -e "s|^$i//*||p" ) )
+                 $( compgen -d -- $i/$cur | sed -e "s|^$i/\(.*\)|\1.|" )
+                 $( compgen -f -X '!*.class' -- $i/$cur | sed -e "s|^$i/||" )
+            )
 
             # FIXME: if we have foo.class and foo/, the completion
             # returns "foo/"... how to give precedence to files
-- 
1.7.0.4


--=-lpCeGqGA4/M0sed9InoL--




More information about the Bash-completion-devel mailing list