diff options
Diffstat (limited to 'etc/bash_completion.d/20vyatta-cfg')
-rw-r--r-- | etc/bash_completion.d/20vyatta-cfg | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index bef195d..ddfe360 100644 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -38,7 +38,7 @@ declare -a comp_words=() # commands to unalias declare -a unalias_cmds=( clear configure date debug edit exit load \ - no set show save terminal undebug ) + no run set show save terminal undebug ) for cmd in "${unalias_cmds[@]}"; do unalias $cmd >& /dev/null done @@ -182,6 +182,25 @@ exit () set_config_ps1 '' } +# run op mode commands +run () +{ + _vyatta_op_run $@ +} + +# do op mode completion +vyatta_run_complete () +{ + local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; ) + shopt -s extglob nullglob + + COMP_WORDS=( "${COMP_WORDS[@]:1}" ) + (( COMP_CWORD -= 1 )) + _vyatta_op_expand + + eval $restore_shopts +} + declare v_cfg_completion_debug=0 decho () { @@ -859,4 +878,5 @@ complete -F vyatta_config_complete delete complete -F vyatta_config_complete show complete -F vyatta_config_complete edit complete -F vyatta_config_complete exit +complete -F vyatta_run_complete run |