From 1bfc56dce4427e10da9c4522acea682ecaa170d1 Mon Sep 17 00:00:00 2001 From: Tom Grennan Date: Fri, 5 Oct 2007 15:10:20 -0700 Subject: fix completion of nodes with wild card and named args (i.e "set") --- etc/bash_completion.d/vyatta-op | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index 4b6bdfc..be4892d 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -277,13 +277,19 @@ _vyatta_op_expand () if _vyatta_op_scan 0 "${COMP_WORDS[@]}" ; then COMPREPLY=( ) if [ -n "${_vyatta_op_allowed[*]}" ] ; then + local nomatch=true + local joker=false for a in "${_vyatta_op_allowed[@]}" ; do if [ -n "$a" ] ; then COMPREPLY+=($( compgen -W "$a" -- $cur )) + [[ -n "$cur" && $a == ${cur}* ]] && \ + nomatch=false else - COMPREPLY+=( "" ) + joker=true fi done + $nomatch && $joker && \ + COMPREPLY+=( "" " " ) fi if [[ ${#COMPREPLY[@]} -ne 0 || -z "${_vyatta_op_allowed[*]}" ]] && [[ "${COMP_WORDS[*]}" == "${_vyatta_op_comp_words[*]}" ]] -- cgit v1.2.3