summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-10-05 17:53:35 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-10-05 17:53:35 -0500
commit06e6e83171c3176ce0478866e759aa74e5970a8b (patch)
treeea3a0d461bfe7059e5e21d663e603822b1e0cc93 /etc
parent6fd980cba446ebbfdae9b46a315378c7b258da9a (diff)
downloadvyatta-cfg-06e6e83171c3176ce0478866e759aa74e5970a8b.tar.gz
vyatta-cfg-06e6e83171c3176ce0478866e759aa74e5970a8b.zip
fix stuck completion on non-lastword
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bash_completion.d/vyatta-cfg13
1 files changed, 11 insertions, 2 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index 3948b51..c4cb036 100755
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -591,6 +591,7 @@ vyatta_simple_complete ()
fi
if [[ $DBG_CFG_COMPS -eq 1 ]]; then
+ echo -e "\n In simple complete"
echo "cur: $cur"
echo "f_comps: ${f_comps[@]}"
fi
@@ -599,6 +600,10 @@ vyatta_simple_complete ()
[ -n "$cur" ] &&
[[ "${f_comps[0]}" =~ "$cur" ]]; then
vyatta_do_help=false
+ elif [ ${#f_comps[@]} -eq 1 ] &&
+ [ -n "$current_prefix" ] &&
+ [[ "${f_comps[0]}" =~ "$current_prefix" ]]; then
+ vyatta_do_help=false
elif $vyatta_do_help ||
[ ${#vyatta_completions[@]} -eq 0 ]; then
printf "$vyatta_help_text"
@@ -838,10 +843,14 @@ vyatta_config_complete ()
echo -e "Last comp: $last_comp"
fi
- if [[ -z "$current_prefix" ]] &&
+ if [[ -n "$current_word" ]] &&
[[ -n "$last_comp" ]] &&
[[ ! "$current_word" =~ "$last_comp" ]]; then
- api_args=( "${api_args[@]:0:$COMP_CWORD}" "" )
+ if [ -n "$current_prefix" ];then
+ api_args=( "${api_args[@]:0:$[$COMP_CWORD]}" "$current_prefix" )
+ else
+ api_args=( "${api_args[@]:0:$COMP_CWORD}" "" )
+ fi
fi
if ! vyatta_cli_shell_api getCompletionEnv "${api_args[@]}"; then
# invalid completion