summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2009-05-28 14:50:36 -0700
committerBob Gilligan <gilligan@vyatta.com>2009-05-28 14:50:36 -0700
commitf209201a04b37c570690fc509042eff049a418ce (patch)
treec418a0ecba95aec577d6911bd465997f50307645 /etc
parenta16a81ffeac475584707a2fe6bbf2e3e388b54df (diff)
downloadvyatta-cfg-f209201a04b37c570690fc509042eff049a418ce.tar.gz
vyatta-cfg-f209201a04b37c570690fc509042eff049a418ce.zip
Bugfix 4235: Add help text for "load" and "save" commands in config mode.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg53
1 files changed, 53 insertions, 0 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index ef8810a..34724f8 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -373,6 +373,57 @@ vyatta_run_complete ()
eval $restore_shopts
}
+vyatta_save_complete()
+{
+ # Generate completion help for the "save" command
+ local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
+ shopt -s extglob nullglob
+
+ if (( $COMP_CWORD <= 1 )); then
+ echo
+ echo "Possible completions:"
+ echo -e " <file>\t\t\t\tSave to file on local machine"
+ echo -e " scp://<user>:<passwd>@<host>/<file>\tSave to file on remote machine"
+ echo -e " ftp://<user>:<passwd>@<host>/<file>\tSave to file on remote machine"
+ echo -e " tftp://<host>/<file>\t\t\tSave to file on remote machine"
+
+ COMP_WORDS=( "${COMP_WORDS[@]:1}" )
+ (( COMP_CWORD -= 1 ))
+ COMPREPLY=( "" " " )
+ else
+ COMPREPLY=()
+ fi
+
+ eval $restore_shopts
+}
+
+vyatta_load_complete()
+{
+ # Generate completion help for the "load" command
+ local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
+ shopt -s extglob nullglob
+
+ if (( $COMP_CWORD <= 1 )); then
+ echo
+ echo "Possible completions:"
+ echo -e " <file>\t\t\t\tLoad from file on local machine"
+ echo -e " scp://<user>:<passwd>@<host>/<file>\tLoad from file on remote machine"
+ echo -e " ftp://<user>:<passwd>@<host>/<file>\tLoad from file on remote machine"
+ echo -e " http://<user>:<passwd>@<host>/<file>\tLoad from file on remote machine"
+ echo -e " tftp://<host>/<file>\t\t\tLoad from to file on remote machine"
+
+ COMP_WORDS=( "${COMP_WORDS[@]:1}" )
+ (( COMP_CWORD -= 1 ))
+ COMPREPLY=( "" " " )
+ else
+ COMPREPLY=()
+ fi
+
+ eval $restore_shopts
+}
+
+
+
declare v_cfg_completion_debug=0
decho ()
{
@@ -1167,6 +1218,8 @@ complete -F vyatta_config_complete show
complete -F vyatta_config_complete edit
complete -F vyatta_config_complete exit
complete -F vyatta_run_complete run
+complete -F vyatta_save_complete save
+complete -F vyatta_load_complete load
# Local Variables:
# mode: shell-script