From e8e887cb4e7ce38c5e0a0eca8069c0bb2225969d Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Tue, 9 Nov 2010 18:13:51 -0800 Subject: Add optional minutes parameter to commit-confirm. --- etc/bash_completion.d/20vyatta-cfg | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index 9c639dc..7ac1ee1 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -119,12 +119,27 @@ commit () commit-confirm () { - cmd="${vyatta_sbindir}/vyatta-config-mgmt.pl --action=commit-confirm \ - --minutes=5" - eval "sudo sg vyattacfg \"$cmd\" " - if [ $? = 0 ]; then - commit "$@" + local -a args=() + local first=1 + local minutes=10 + for arg in "$@"; do + if [ "$first" = "1" ]; then + if [[ $arg = *[[:digit:]]* ]]; then + minutes=$arg + else + args[${#args[@]}]="$arg" + fi + first=0 + else + args[${#args[@]}]="$arg" fi + done + cmd="${vyatta_sbindir}/vyatta-config-mgmt.pl --action=commit-confirm \ + --minutes=$minutes" + eval "sudo sg vyattacfg \"$cmd\" " + if [ $? = 0 ]; then + commit "$@" + fi } confirm () -- cgit v1.2.3