summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-11-09 18:13:51 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-11-09 18:13:51 -0800
commite8e887cb4e7ce38c5e0a0eca8069c0bb2225969d (patch)
tree38042dc925197769e442ad53be45e8c5c7dc7448 /etc
parent8d750fc2164ed2db0a7784a7d74ae5644526364b (diff)
downloadvyatta-cfg-e8e887cb4e7ce38c5e0a0eca8069c0bb2225969d.tar.gz
vyatta-cfg-e8e887cb4e7ce38c5e0a0eca8069c0bb2225969d.zip
Add optional minutes parameter to commit-confirm.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg25
1 files 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 ()