summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-11-11 15:29:28 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-11-11 15:29:28 -0800
commite99ff0cc0c9337b01495e301bfcbcd6694afc557 (patch)
tree8b1198503500a06343266116b7873bb60e998a43 /etc
parent5ea31049e7aa8a25450b4d3a6646191ac359d4dd (diff)
downloadvyatta-cfg-e99ff0cc0c9337b01495e301bfcbcd6694afc557.tar.gz
vyatta-cfg-e99ff0cc0c9337b01495e301bfcbcd6694afc557.zip
Add completion for rollback.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg30
1 files changed, 29 insertions, 1 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index 7ac1ee1..d2d35ed 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -376,6 +376,34 @@ vyatta_loadkey_complete()
esac
}
+vyatta_rollback_complete ()
+{
+ # Generate completion help for the "rollback" command
+
+ local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
+ shopt -s extglob nullglob
+
+ # Only provide completions after command name has been typed, but
+ # before any characters of the command argument have been entered.
+ if [ $COMP_CWORD -eq 1 -a -z "${COMP_WORDS[1]}" ]; then
+ echo
+ echo "Possible completions:"
+ local -a array
+ eval "array=($(${vyatta_sbindir}/vyatta-config-mgmt.pl --action=show-commit-log-brief))"
+ local count=0
+ for i in "${array[@]}"; do
+ i=${i//_/ }
+ echo -e "$count\t$i"
+ (( count++ ))
+ done
+ COMPREPLY=( "" " " )
+ else
+ COMPREPLY=()
+ fi
+
+ eval $restore_shopts
+}
+
get_prefix_filtered_list ()
{
# $1: prefix
@@ -790,7 +818,7 @@ complete -F vyatta_config_complete compare
complete -F vyatta_config_complete comment
complete -F vyatta_config_complete copy
complete -F vyatta_config_complete rename
-complete -F vyatta_config_complete rollback
+complete -F vyatta_rollback_complete rollback
# Local Variables:
# mode: shell-script