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.
This commit is contained in:
Ville Skyttä 2010-01-30 12:41:54 +02:00
parent b996ff01cb
commit c5470fdf74

View File

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