diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-10-04 19:04:24 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-10-04 19:04:24 -0500 |
commit | 82f699844f3704b6be3e327da2bf6d96aee3bf43 (patch) | |
tree | cc729e1793dab5ce140b1013f0f8701e9731523e | |
parent | 40f3f396086aa867b42b70ee1d357e22564f4c5b (diff) | |
download | vyatta-cfg-82f699844f3704b6be3e327da2bf6d96aee3bf43.tar.gz vyatta-cfg-82f699844f3704b6be3e327da2bf6d96aee3bf43.zip |
Fix the handling of tag nodes in config mode completions
-rwxr-xr-x | etc/bash_completion.d/vyatta-cfg | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg index bdc2888..787a363 100755 --- a/etc/bash_completion.d/vyatta-cfg +++ b/etc/bash_completion.d/vyatta-cfg @@ -554,11 +554,17 @@ vyatta_simple_complete () # (i.e., only those starting with the current last component). compopt -o nospace local cur=${COMP_WORDS[COMP_CWORD]} - if [ ${#vyatta_completions[@]} -eq 1 ] && + local -a f_comps=() + get_prefix_filtered_list "$cur" vyatta_completions f_comps + f_comps=( $(printf "%s\n" "${vyatta_completions[@]}" | sort -u) ) + if [[ $DBG_CFG_COMPS -eq 1 ]]; then + echo "cur: $cur" + echo "f_comps: ${f_comps[@]}" + fi + if [ ${#f_comps[@]} -eq 1 ] && [ -n "$cur" ] && - [[ "${vyatta_completions[0]}" =~ "$cur" ]]; then - COMPREPLY=( "${vyatta_completions[0]} " ) - vyatta_do_help=true + [[ "${f_comps[0]}" =~ "$cur" ]]; then + COMPREPLY=( "${f_comps[0]} " ) elif $vyatta_do_help || [ ${#vyatta_completions[@]} -eq 0 ]; then printf "$vyatta_help_text" |