summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-10-31 13:46:53 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2007-10-31 13:46:53 -0700
commit86403f8672d2fb023ff99a6ffe83bb2cc92f1ca2 (patch)
treef3f1d11d1d1589a01015dd8e86ee8fad723ce367 /etc/bash_completion.d
parent7fa060f335bfbbd2bcfc0f4d9d9c89904036ef27 (diff)
downloadvyatta-cfg-86403f8672d2fb023ff99a6ffe83bb2cc92f1ca2.tar.gz
vyatta-cfg-86403f8672d2fb023ff99a6ffe83bb2cc92f1ca2.zip
add config-mode "run" command (for running op mode commands).
Diffstat (limited to 'etc/bash_completion.d')
-rw-r--r--etc/bash_completion.d/20vyatta-cfg22
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