summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion.d/vyatta-cfg20
1 files changed, 15 insertions, 5 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index b16ffbf..8977331 100644
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -52,11 +52,6 @@ save ()
eval "${vyatta_sbindir}/vyatta-save-config.pl $@"
}
-load ()
-{
- eval "${vyatta_sbindir}/vyatta-load-config.pl $@"
-}
-
declare vyatta_cfg_prompt_level=''
set_config_ps1 ()
{
@@ -70,6 +65,21 @@ set_config_ps1 ()
fi
}
+load ()
+{
+ # 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 $@"
+}
+
edit ()
{
local num_comp=${#@}