summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-09-30 17:42:16 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-09-30 17:42:16 -0500
commit35d8986492216fd37c60821e15bb864a70c138a1 (patch)
tree2453a2170d3173ab8679d10ab7ba10716beb08d0
parentbe95cc84f05d69c8146018fa749cd6181e41ee4f (diff)
downloadvyatta-op-35d8986492216fd37c60821e15bb864a70c138a1.tar.gz
vyatta-op-35d8986492216fd37c60821e15bb864a70c138a1.zip
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
-rw-r--r--etc/bash_completion.d/vyatta-op19
1 files changed, 12 insertions, 7 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index 87e2625..fd38763 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')