[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 9a63f2983d2269551cf573af72f111fcac267045
Ville Skyttä
ville.skytta at iki.fi
Tue May 12 21:07:02 UTC 2009
The following commit has been merged in the master branch:
commit f5991cc3c1f422b6df2233cc14f83edfc9989617
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed May 13 00:01:35 2009 +0300
Protect java class completion from unusual input, get rid of one grep.
diff --git a/bash_completion b/bash_completion
index 914fb65..2afcc9c 100644
--- a/bash_completion
+++ b/bash_completion
@@ -4735,19 +4735,19 @@ _java_classes()
# parse each classpath element for classes
for i in ${classpath//:/ }; do
if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
- if type zipinfo &> /dev/null; then
+ if type zipinfo &>/dev/null; then
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
- "$i" | grep "^$cur" | grep '\.class$' | \
- grep -v "\\$" ) )
+ "$i" "$cur*" 2>/dev/null | \
+ grep '^[^$]*\.class$' ) )
else
COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
- "$cur" | grep "\.class$" | grep -v "\\$" ) )
+ "$cur" | grep '^[^$]*\.class$' ) )
fi
elif [ -d $i ]; then
i=${i%/}
- # See bug #496828
+ # See Debian bug #496828
COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
-maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
grep -v "\\$" | sed -e "s|^$i/||" ) )
--
bash-completion
More information about the Bash-completion-commits
mailing list