Fix regression when calling *_custom_func (#1001)
PR #889 introduced a regression where the global variable $c is no longer set when *custom_func is called. This is because $c is re-used by mistake in the read loop. This PR simply changes the name of the variable used in the loop. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
This commit is contained in:
parent
447f182a9d
commit
bf26895664
@ -61,6 +61,7 @@ __%[1]s_contains_word()
|
|||||||
__%[1]s_handle_reply()
|
__%[1]s_handle_reply()
|
||||||
{
|
{
|
||||||
__%[1]s_debug "${FUNCNAME[0]}"
|
__%[1]s_debug "${FUNCNAME[0]}"
|
||||||
|
local comp
|
||||||
case $cur in
|
case $cur in
|
||||||
-*)
|
-*)
|
||||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||||
@ -72,8 +73,8 @@ __%[1]s_handle_reply()
|
|||||||
else
|
else
|
||||||
allflags=("${flags[*]} ${two_word_flags[*]}")
|
allflags=("${flags[*]} ${two_word_flags[*]}")
|
||||||
fi
|
fi
|
||||||
while IFS='' read -r c; do
|
while IFS='' read -r comp; do
|
||||||
COMPREPLY+=("$c")
|
COMPREPLY+=("$comp")
|
||||||
done < <(compgen -W "${allflags[*]}" -- "$cur")
|
done < <(compgen -W "${allflags[*]}" -- "$cur")
|
||||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||||
[[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
|
[[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
|
||||||
@ -124,13 +125,13 @@ __%[1]s_handle_reply()
|
|||||||
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
|
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
|
||||||
completions+=("${must_have_one_flag[@]}")
|
completions+=("${must_have_one_flag[@]}")
|
||||||
fi
|
fi
|
||||||
while IFS='' read -r c; do
|
while IFS='' read -r comp; do
|
||||||
COMPREPLY+=("$c")
|
COMPREPLY+=("$comp")
|
||||||
done < <(compgen -W "${completions[*]}" -- "$cur")
|
done < <(compgen -W "${completions[*]}" -- "$cur")
|
||||||
|
|
||||||
if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
|
if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
|
||||||
while IFS='' read -r c; do
|
while IFS='' read -r comp; do
|
||||||
COMPREPLY+=("$c")
|
COMPREPLY+=("$comp")
|
||||||
done < <(compgen -W "${noun_aliases[*]}" -- "$cur")
|
done < <(compgen -W "${noun_aliases[*]}" -- "$cur")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user