summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-10-03 11:24:03 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-10-03 11:24:03 -0500
commit22572cc466addd0467da3200456b4ff0148ebe28 (patch)
tree3e5afd3d1344b897894ab3f9c10ce47eadfa9fb8
parentdceae0c857cffe54110e50081a2f62534794bf25 (diff)
downloadvyatta-cfg-22572cc466addd0467da3200456b4ff0148ebe28.tar.gz
vyatta-cfg-22572cc466addd0467da3200456b4ff0148ebe28.zip
Prevent config mode completions from getting stuck when backspacing over them
-rwxr-xr-xetc/bash_completion.d/vyatta-cfg5
1 files changed, 4 insertions, 1 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index 9e9d652..ad1ccb0 100755
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -430,7 +430,10 @@ vyatta_simple_complete ()
# * "vyatta_help_text" is filled with the help text.
# * "vyatta_completions" is an array of "filtered" possible completions
# (i.e., only those starting with the current last component).
- if $vyatta_do_help; then
+ if [ ${#vyatta_completions[@]} -eq 1 ] &&
+ [[ "${vyatta_completions[0]}" =~ "${COMP_WORDS[COMP_CWORD]}" ]]; then
+ COMPREPLY=( "${vyatta_completions[@]}" )
+ elif $vyatta_do_help; then
printf "$vyatta_help_text"
COMPREPLY=( "" " " )
else