summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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