From f661fa9e0035639bbbfd89187b6cdb5b2c0090e6 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Tue, 25 Sep 2007 18:20:50 -0700 Subject: config-mode "load" command * disallow if there are uncommitted changes. * now works with "edit". --- etc/bash_completion.d/vyatta-cfg | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'etc/bash_completion.d/vyatta-cfg') 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=${#@} -- cgit v1.2.3