groupstats.pl: Improve automatic adaption of output type.
authorThomas Hochstein <thh@inter.net>
Sun, 31 Oct 2010 21:00:16 +0000 (22:00 +0100)
committerThomas Hochstein <thh@inter.net>
Sun, 31 Oct 2010 22:15:18 +0000 (23:15 +0100)
If time period is more than on month, switch from dump
to dumpgroup, if possible (just one newsgroup submitted
via -n), and switch to pretty only if that fails.

Signed-off-by: Thomas Hochstein <thh@inter.net>
groupstats.pl

index f758b8c..ef59cb7 100755 (executable)
@@ -73,10 +73,15 @@ if ($Options{'l'}) {
 
 ### get time period
 my ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
 
 ### get time period
 my ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
-# reset to one month for 'dump' output type
+# if time period is more than one month: set output type to '-o pretty' or '-o dumpgroup'
 if ($Options{'o'} eq 'dump' and $Options{'p'}) {
 if ($Options{'o'} eq 'dump' and $Options{'p'}) {
-  warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n");
-  $Options{'o'} = 'pretty';
+  if (defined($Options{'n'}) and $Options{'n'} !~ /:|\*/) {
+   warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o dumpgroup'.\n");
+   $Options{'o'} = 'dumpgroup';
+  } else {
+   warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n");
+   $Options{'o'} = 'pretty';
+  }
 };
 
 ### init database
 };
 
 ### init database
This page took 0.011983 seconds and 4 git commands to generate.