bash-completion/backticks-bsc963140.patch

46 lines
1.4 KiB
Diff

---
bash-completion-2.7/bash_completion | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
Index: bash-completion-2.11/bash_completion
===================================================================
--- bash-completion-2.11.orig/bash_completion
+++ bash-completion-2.11/bash_completion
@@ -1059,13 +1059,21 @@ _dollar()
[[ "$COMP_LINE" == cd* ]] && s="/"
case "$1" in
+ \$\(*\))
+ ((glob == 0)) && shopt -u extglob
+ return 0
+ ;;
\$\(*)
- COMPREPLY=($(compgen -c -P '$(' -S ")$s" -- ${1#??}))
- let cmd++
+ COMPREPLY=($(compgen -c -P '$(' -S ")$s" -- ${1:2}))
+ ((${#COMPREPLY[@]} <= 0)) && let cmd++
+ ;;
+ \`*\`)
+ ((glob == 0)) && shopt -u extglob
+ return 0
;;
\`*)
- COMPREPLY=($(compgen -c -P '\`' -S "\`$s" -- ${1#?}))
- let cmd++
+ COMPREPLY=($(compgen -c -P '\`' -S "\`$s" -- ${1:1}))
+ ((${#COMPREPLY[@]} <= 0)) && let cmd++
;;
\$\{*)
COMPREPLY=($(compgen -v -P '${' -S "}$s" -- ${1#??})) ;;
@@ -1078,8 +1086,8 @@ _dollar()
if ((${#COMPREPLY[@]} > 0)) ; then
((${#COMPREPLY[@]} == 1)) && eval COMPREPLY=\(${COMPREPLY[@]}\)
- elif ((cmd == 0)); then
- eval COMPREPLY=\(${1}\)
+ elif ((cmd > 0)); then
+ compopt -o default -o bashdefault -o nospace
fi
((glob == 0)) && shopt -u extglob