[Rt-commit] [rtir] 02/05: Add a --force flag

Kevin Falcone falcone at bestpractical.com
Fri Sep 26 16:41:53 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2-trunk
in repository rtir.

commit fd04d6f87e6fd562f2f2a9fe329685e4bc725660
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Sep 24 12:54:16 2014 -0400

    Add a --force flag
    
    This lets you skip the prompt about updating (useful for automating, or
    running from tests).
---
 bin/add_constituency.in | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/bin/add_constituency.in b/bin/add_constituency.in
index ef86cda..740debd 100755
--- a/bin/add_constituency.in
+++ b/bin/add_constituency.in
@@ -14,6 +14,8 @@ add_constituency - add or update constitiuensies
 
     add_constituency --name <constituency> --rename <new value>
 
+    add_constituency --name EDUNET --force
+
 =head1 OPTIONS
 
 =over 4
@@ -38,6 +40,10 @@ Rename constituency, use this option to set new value when --name defines old.
 
 Disable output.
 
+=item --force
+
+Don't prompt about changes to be made, useful to combine with --quiet
+
 =back
 
 =head1 DESCRIPTION
@@ -68,7 +74,7 @@ sub debug(@) {
 };
 
 use Getopt::Long;
-GetOptions( \%opt, "name=s", "rename=s", "correspond=s", "comment=s", "help", "quiet" );
+GetOptions( \%opt, "name=s", "rename=s", "correspond=s", "comment=s", "help", "quiet", "force" );
 
 if ( $opt{'help'} ) {
     require Pod::Usage;
@@ -119,10 +125,12 @@ print <<END;
 
 END
 
-if ( $exist ) {
-    exit 0 unless prompt_yN( "Do you want to proceed with update?" );
-} else {
-    exit 0 unless prompt_yN( "Do you want to proceed creating new incident?" );
+unless ( $opt{'force'} ) {
+    if ( $exist ) {
+        exit 0 unless prompt_yN( "Do you want to proceed with update?" );
+    } else {
+        exit 0 unless prompt_yN( "Do you want to proceed creating new incident?" );
+    }
 }
 
 debug "Adding constituency $constituency";

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list