[Bps-public-commit] r18847 - Shipwright/trunk/share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Mar 19 03:31:34 EDT 2009


Author: sunnavy
Date: Thu Mar 19 03:31:33 2009
New Revision: 18847

Modified:
   Shipwright/trunk/share/bin/shipwright-builder

Log:
remember the options for the last run so we do not need to reinput

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Thu Mar 19 03:31:33 2009
@@ -19,8 +19,19 @@
 my $build_base = getcwd;
 my $inc_lib = catdir( $build_base, 'inc' );
 
+if ( @ARGV )  {
+    open my $fh, '>', '__default_option'
+      or confess "can't write to __default_option: $!";
+    print $fh $_, "\n" for @ARGV;
+    close $fh;
+}
+else {
+    @ARGV = get_default_option();
+}
+
 my %args;
 
+use Getopt::Long;
 confess "unknown option"
   unless GetOptions(
     \%args,                   'install-base=s',
@@ -680,6 +691,17 @@
     }
 }
 
+sub get_default_option {
+    my @argv;
+    if ( open my $fh, '<', '__default_option' ) {
+        while( <$fh> ) {
+            chomp;
+            push @argv, $_;
+        }
+        close $fh;
+    }
+}
+
 sub process_tmp_dists {
     mkdir 'tmp_dists';
 



More information about the Bps-public-commit mailing list