From f209201a04b37c570690fc509042eff049a418ce Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Thu, 28 May 2009 14:50:36 -0700 Subject: Bugfix 4235: Add help text for "load" and "save" commands in config mode. --- etc/bash_completion.d/20vyatta-cfg | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'etc') 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 " \t\t\t\tSave to file on local machine" + echo -e " scp://:@/\tSave to file on remote machine" + echo -e " ftp://:@/\tSave to file on remote machine" + echo -e " tftp:///\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 " \t\t\t\tLoad from file on local machine" + echo -e " scp://:@/\tLoad from file on remote machine" + echo -e " ftp://:@/\tLoad from file on remote machine" + echo -e " http://:@/\tLoad from file on remote machine" + echo -e " tftp:///\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 -- cgit v1.2.3