summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2009-05-21 17:28:04 -0700
committerBob Gilligan <gilligan@vyatta.com>2009-05-21 17:28:04 -0700
commit4d325a4175544c09033dd2e72fe6f579748c7a76 (patch)
treea631b6ae40b24afacd2e6da912c2e6620c85381c
parentd1cb1b31135fda65d9a89fc61ce31249146f53c0 (diff)
parent6532ac36bd6b6590edbffc725d7d2fe75dab2c7d (diff)
downloadvyatta-cfg-4d325a4175544c09033dd2e72fe6f579748c7a76.tar.gz
vyatta-cfg-4d325a4175544c09033dd2e72fe6f579748c7a76.zip
Merge branch 'jenner' of http://git.vyatta.com/vyatta-cfg into jenner
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg21
1 files changed, 19 insertions, 2 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index ac573fa..ef8810a 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -46,7 +46,7 @@ declare last_idx=0
declare -a comp_words=()
# commands to unalias
-declare -a unalias_cmds=( clear configure date debug edit exit load \
+declare -a unalias_cmds=( clear configure date debug edit exit load load-merge \
no run set show save terminal undebug up top )
for cmd in "${unalias_cmds[@]}"; do
unalias $cmd >& /dev/null
@@ -138,6 +138,21 @@ load ()
eval "${vyatta_sbindir}/vyatta-load-config.pl $@"
}
+load-merge ()
+{
+ # don't load if there are uncommitted changes.
+ if [ -f "$VYATTA_TEMP_CONFIG_DIR/$VYATTA_MOD_NAME" ]; then
+ echo "Cannot load: configuration modified."
+ echo "Commit or discard the changes before loading a config file."
+ return 1
+ fi
+ # return to top level.
+ export VYATTA_EDIT_LEVEL="/"
+ export VYATTA_TEMPLATE_LEVEL="/"
+ set_config_ps1 ''
+ eval "${vyatta_sbindir}/vyatta-load-config.pl $@ --merge"
+}
+
top ()
{
if [ "$VYATTA_EDIT_LEVEL" == "/" ]; then
@@ -840,6 +855,7 @@ vyatta_config_complete ()
"edit" \
"exit" \
"load" \
+ "load-merge" \
"rename" \
"run" \
"save" \
@@ -852,7 +868,8 @@ vyatta_config_complete ()
"Discard uncommitted changes" \
"Edit a sub-element" \
"Exit from this configuration level" \
- "Load configuration from a file" \
+ "Load configuration from a file and replace running configuration" \
+ "Load configuration from a file and merge running configuration" \
"Rename a configuration element" \
"Run an operational-mode command" \
"Save configuration to a file" \