diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-09-25 18:20:50 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-09-25 18:20:50 -0700 |
commit | f661fa9e0035639bbbfd89187b6cdb5b2c0090e6 (patch) | |
tree | 4e496130591e54b7d45e876e6e4adad41884a6d2 /etc | |
parent | fa0e94cc00ef3d4cbb3b3d62eb31be64b12e8e24 (diff) | |
download | vyatta-cfg-f661fa9e0035639bbbfd89187b6cdb5b2c0090e6.tar.gz vyatta-cfg-f661fa9e0035639bbbfd89187b6cdb5b2c0090e6.zip |
config-mode "load" command
* disallow if there are uncommitted changes.
* now works with "edit".
Diffstat (limited to 'etc')
-rw-r--r-- | etc/bash_completion.d/vyatta-cfg | 20 |
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=${#@} |