diff --git a/complete-ng b/complete-ng index 5802589..6ef894c 100644 --- a/complete-ng +++ b/complete-ng @@ -371,8 +371,8 @@ _complete-ng() { [ "$_compfunc__D" ] && { $_compfunc__D "$@" # _completion_loader \complete -F _complete-ng -I 2>/dev/null - eval $(\complete -p "$cmd" 2>/dev/null) # alias not necessary enable for bash completion loader eval $(\complete -p -E 2>/dev/null) + eval $(\complete -p "$cmd" 2>/dev/null) # alias not necessary enable for bash completion loader fn=$(eval printf %s '$'_compfunc_"${cmd//[^a-zA-Z0-9_]/_}") } } @@ -402,15 +402,15 @@ complete-ng() { unset fn ! [[ $1 =~ $exc ]] && { func="$1"; shift; set -- "$@" _complete-ng; continue; } } - [ "$1" = "-F" ] && fn=1 && cmd="" - cmd+="$1 " + [ "$1" = "-F" ] && fn=1 && cmd=() + [ $1 = -- ] || cmd+=("$1") set -- "$@" "$1" shift done - [[ "$*" =~ -F\ [^\ ]*$ ]] && set -- "$@" "''" && cmd="''" + [[ "$*" =~ -F\ [^\ ]*$ ]] && set -- "$@" "''" && cmd=("''") [ "$func" ] && { local c - for c in $cmd;do + for c in "${cmd[@]}";do c=${c//"'"/} eval "_compfunc_${c//[^a-zA-Z0-9_]/_}=$func" done