summaryrefslogtreecommitdiff
path: root/etc
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:58:10 -0500
commitfd3b0a406a9cb78d55fd9b0e0d597e91a6eb7b63 (patch)
tree1872bb03feb2e1ce107f431bb119ec2c19c320a4 /etc
parentdc73cf6efeaf5d1577c930f29417fe323502edd9 (diff)
downloadvyatta-op-fd3b0a406a9cb78d55fd9b0e0d597e91a6eb7b63.tar.gz
vyatta-op-fd3b0a406a9cb78d55fd9b0e0d597e91a6eb7b63.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
Diffstat (limited to 'etc')
-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 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')