[Bash-completion-commits] [SCM] bash-completion branch, dynamic-loading, updated. 1.3-474-g3b02989
Ville Skyttä
ville.skytta at iki.fi
Tue Oct 25 17:20:17 UTC 2011
The following commit has been merged in the dynamic-loading branch:
commit 3b029892f6f9db3b7210a7f66d636be3e5ec5fa2
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Tue Oct 25 20:15:13 2011 +0300
_init_completion: Improve variable name completion.
Complete only things that look like variable names to make things like
$HOME/<TAB> and $(<TAB> pass through, and fix completion of variables
enclosed in braces.
diff --git a/bash_completion b/bash_completion
index eb5fffc..1656a71 100644
--- a/bash_completion
+++ b/bash_completion
@@ -645,8 +645,10 @@ _init_completion()
_get_comp_words_by_ref -n "$exclude<>&" cur prev words cword
# Complete variable names.
- if [[ $cur == \$* ]]; then
- COMPREPLY=( $( compgen -P '$' -v -- "${cur#\$}" ) )
+ if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then
+ [[ $cur == *{* ]] && local suffix=} || local suffix=
+ COMPREPLY=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \
+ "${BASH_REMATCH[2]}" ) )
return 1
fi
--
bash-completion
More information about the Bash-completion-commits
mailing list