diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-10-18 18:50:20 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-10-18 18:50:20 -0500 |
commit | 35da8e1ee49f94163028766961c5a4951fa2fb07 (patch) | |
tree | c570d75e321b36d196e925ab2ebfed47c7e7b803 | |
parent | 447256e15c0594f15f51bc123538aaf4e795a276 (diff) | |
download | vyatta-cfg-35da8e1ee49f94163028766961c5a4951fa2fb07.tar.gz vyatta-cfg-35da8e1ee49f94163028766961c5a4951fa2fb07.zip |
Fix broken completion for copy and rename second parameter
-rwxr-xr-x | etc/bash_completion.d/vyatta-cfg | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg index c926ca1..81d41f5 100755 --- a/etc/bash_completion.d/vyatta-cfg +++ b/etc/bash_completion.d/vyatta-cfg @@ -801,6 +801,7 @@ vyatta_config_complete () local current_word=$3 local current_prefix=$2 + local comp_cword=$COMP_CWORD #mutable copy of COMP_CWORD so we can modify it for copy and rename if [[ "$COMP_LINE" == "$VYATTA_COMP_LINE" ]]; then VYATTA_COMP_LINE=$VYATTA_COMP_LINE_EMPTY @@ -896,6 +897,7 @@ vyatta_config_complete () return elif (( COMP_CWORD > 3 && COMP_CWORD < 6 )); then # If parsing index 4 or 5, start completion at <param2>. + (( comp_cword -= 3 )) api_args=("$command" "${COMP_WORDS[@]:4}") elif (( COMP_CWORD > 5 )); then # If parsing after index 5, there are no more valid parameters @@ -924,9 +926,9 @@ vyatta_config_complete () [[ -n "$last_comp" ]] && [[ ! "$current_word" =~ "$last_comp" ]]; then if [[ -n "$current_prefix" ]];then - api_args=( "${api_args[@]:0:$[$COMP_CWORD]}" "$current_prefix" ) + api_args=( "${api_args[@]:0:$[$comp_cword]}" "$current_prefix" ) else - api_args=( "${api_args[@]:0:$COMP_CWORD}" "" ) + api_args=( "${api_args[@]:0:$comp_cword}" "" ) fi fi if ! vyatta_cli_shell_api getCompletionEnv "${api_args[@]}"; then |