diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-12-14 18:40:37 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-12-14 18:40:37 -0800 |
commit | 240da11791724d0e252fa3263e56ad916210de60 (patch) | |
tree | e5ec70eea34c73662df9c531ad6318d76b7c0365 /etc | |
parent | 1d607f20586703e8116ec105be68595db3e2f467 (diff) | |
download | vyatta-op-240da11791724d0e252fa3263e56ad916210de60.tar.gz vyatta-op-240da11791724d0e252fa3263e56ad916210de60.zip |
provide default filename completion
Diffstat (limited to 'etc')
-rw-r--r-- | etc/bash_completion.d/vyatta-op | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index 06cb03a..49b6768 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -77,11 +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 () { # empty and default line compeletion complete -E -F _vyatta_op_expand - complete -D -F _vyatta_op_expand + complete -D -F _vyatta_op_default_expand for xd in $vyatta_op_templates/* ; do if [ -d $xd ] ; then |