From fd3b0a406a9cb78d55fd9b0e0d597e91a6eb7b63 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Fri, 30 Sep 2011 17:42:16 -0500 Subject: Always attempt to set the node path, this gives us a chance to fail on invalid or ambiguous commands with out waiting for the user to hit tab twice --- etc/bash_completion.d/vyatta-op | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'etc') diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index 428a559..f10084a 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -326,15 +326,20 @@ _vyatta_op_expand () eval "$restore_shopts" return fi + + # this needs to be done on every completion even if it is the 'same' comp. + # The cursor can be at different places in the string. + # this will lead to unexpected cases if setting the node path isn't attempted + # each time. + if ! _vyatta_op_set_node_path ; then + echo -e \\a + _vyatta_op_invalid_completion + COMPREPLY=( "" " " ) + eval "$restore_shopts" + return 1 + fi if [ "${COMP_WORDS[*]}" != "$_vyatta_op_last_comp" ] ; then - if ! _vyatta_op_set_node_path ; then - echo -e \\a - _vyatta_op_invalid_completion - COMPREPLY=( "" " " ) - eval "$restore_shopts" - return 1 - fi _vyatta_set_comptype case $_vyatta_comptype in 'imagefiles') -- cgit v1.2.3