[Bps-public-commit] r11630 - in App-Changelogger: bin

sartak at bestpractical.com sartak at bestpractical.com
Tue Apr 8 01:56:31 EDT 2008


Author: sartak
Date: Tue Apr  8 01:56:31 2008
New Revision: 11630

Modified:
   App-Changelogger/   (props changed)
   App-Changelogger/bin/sort-changelog

Log:
 r53731 at onn:  sartak | 2008-04-08 01:56:28 -0400
 Factor out invoking the user's editor, usage line fix


Modified: App-Changelogger/bin/sort-changelog
==============================================================================
--- App-Changelogger/bin/sort-changelog	(original)
+++ App-Changelogger/bin/sort-changelog	Tue Apr  8 01:56:31 2008
@@ -70,7 +70,7 @@
 
 # get the files
 @ARGV == 2
-    or die "Usage: $0 in.xml out.yml";
+    or die "Usage: $0 in.xml out.xml";
 
 my $in = shift;
 my $out = shift;
@@ -173,21 +173,15 @@
 
 sub edit_entry {
     my $entry = shift;
-    my ($fh, $fn) = solicit($entry->{msg});
-    close $fh;
-    $entry->{msg} = do { local (@ARGV, $/) = $fn; <> };
-    $entry->{msg} = reformat_message($entry->{msg});
+    $entry->{msg} = reformat_message(invoke_editor($entry->{msg}));
 }
 
 sub split_entry {
     my $entry = shift;
-    my ($fh, $fn) = solicit($entry->{msg});
-    close $fh;
-    my $msg = do { local (@ARGV, $/) = $fn; <> };
 
     my @msgs = map { reformat_message($_) }
                grep { /\S/ }
-               split /\n-+\n/, $msg;
+               split /\n-+\n/, invoke_editor($entry->{msg});
 
     $entry->{msg} = shift @msgs;
     my @new_entries = map { my %copy = %$entry; $copy{msg} = $_; \%copy } @msgs;
@@ -221,3 +215,10 @@
     return $c;
 }
 
+sub invoke_editor {
+    my $msg = shift;
+    my ($fh, $fn) = solicit($msg);
+    close $fh;
+    return scalar do { local (@ARGV, $/) = $fn; <> };
+}
+



More information about the Bps-public-commit mailing list