summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-04 18:11:54 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-04 18:31:31 -0800
commitae26c25816fe0b68890da70b276cbfc064a7584f (patch)
tree90e8134dba01eca4499fc24cd221f4d7853dba62
parent1fe8bed07a33c6df91959520130c1867afce28df (diff)
downloadvyatta-cfg-ae26c25816fe0b68890da70b276cbfc064a7584f.tar.gz
vyatta-cfg-ae26c25816fe0b68890da70b276cbfc064a7584f.zip
Add alias wrapper for vyatta-load-user-key
Similar to existing load config.
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg32
1 files changed, 32 insertions, 0 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index 5f7896d..03cfe6c 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -416,6 +416,37 @@ vyatta_loadsave_complete()
eval $restore_shopts
}
+loadkey()
+{
+ # 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-user-key.pl $@"
+}
+
+vyatta_loadkey_complete()
+{
+ case "$COMP_CWORD" in
+ 1) COMPREPLY=( $( compgen -u -- ${COMP_WORDS[1]} ) ) ;;
+ 2) if [ -z "${COMP_WORDS[2]}" ]; then
+ echo "Possible completions:"
+ echo -e " <file>\t\t\t\tLoad from file on local machine"
+ echo -e " scp://<user>@<host>/<file>\tLoad from file on remote machine"
+ echo -e " ftp://<user>@<host>/<file>\tLoad from file on remote machine"
+ echo -e " http://<host>/<file>\t\t\tLoad from file on remote machine"
+ echo -e " tftp://<host>/<file>\t\t\tLoad from file on remote machine"
+ fi
+ COMPREPLY=() ;;
+ esac
+}
+
declare v_cfg_completion_debug=0
decho ()
{
@@ -1254,6 +1285,7 @@ complete -F vyatta_run_complete run
complete -F vyatta_loadsave_complete save
complete -F vyatta_loadsave_complete load
complete -F vyatta_loadsave_complete merge
+complete -F vyatta_loadkey_complete loadkey
complete -F vyatta_config_complete copy
complete -F vyatta_config_complete rename