From a4279a5025e4ddd08e5e191e14ee32217be14d23 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Thu, 6 Oct 2011 00:35:48 -0500 Subject: Fix: first word completions; empty completions on tag nodes, if there is a tag node there should always be at least a non-comp so that the help text will be displayed; invalid completions in the middle of the string --- etc/bash_completion.d/vyatta-op | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index 560cbb4..16e25b0 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -103,7 +103,7 @@ _vyatta_op_default_expand () local wc=${#COMP_WORDS[@]} if (( wc < 2 )) || [[ $COMP_CWORD -eq 0 ]]; then - _vyatta_op_expand + _vyatta_op_expand "$@" else # after the first word => cannot be vyatta command so use original default _filedir_xspec @@ -210,7 +210,7 @@ _vyatta_op_set_completions () if [ ${#a[@]} -ne 0 ] ; then allowed+=( "${a[@]}" ) else - allowed+=( "" ) + allowed+=( "" ) fi else local sdir=${ndef%/*} @@ -417,6 +417,12 @@ _vyatta_op_expand () _vyatta_op_invalid_completion COMPREPLY=( "" " " ) _vyatta_op_last_comp=${_vyatta_op_last_comp_init} + elif [ ${#COMPREPLY[@]} -eq 0 ] && + [ -n "$current_prefix" ]; then + echo + _vyatta_op_invalid_completion + COMPREPLY=( "" " " ) + _vyatta_op_last_comp=${_vyatta_op_last_comp_init} # Stop completions from getting stuck elif [ ${#_vyatta_op_completions[@]} -eq 1 ] && [ -n "$cur" ] && -- cgit v1.2.3