summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d
diff options
context:
space:
mode:
Diffstat (limited to 'etc/bash_completion.d')
-rw-r--r--etc/bash_completion.d/vyatta-op (renamed from etc/bash_completion.d/10vyatta-op)19
1 files changed, 18 insertions, 1 deletions
diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/vyatta-op
index 6336038..49b6768 100644
--- a/etc/bash_completion.d/10vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -1,3 +1,4 @@
+# vyatta bash operational mode completion
# **** License ****
# This program is free software; you can redistribute it and/or modify
@@ -76,9 +77,25 @@ _vyatta_op_debug ()
done
}
+# this is needed to provide original "default completion" behavior.
+# see "vyatta-cfg" completion script for details.
+_vyatta_op_default_expand ()
+{
+ local wc=${#COMP_WORDS[@]}
+ if (( wc < 2 )); then
+ _vyatta_op_expand
+ else
+ # after the first word => cannot be vyatta command so use original default
+ compopt -o filenames
+ _filedir_xspec
+ fi
+}
+
_vyatta_op_init ()
{
- complete -F _vyatta_op_expand ''
+ # empty and default line compeletion
+ complete -E -F _vyatta_op_expand
+ complete -D -F _vyatta_op_default_expand
for xd in $vyatta_op_templates/* ; do
if [ -d $xd ] ; then