groupstats.pl: Improve automatic adaption of output type.

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>
This commit is contained in:
Thomas Hochstein 2010-10-31 22:00:16 +01:00
parent b802bc3d29
commit e742bcf550

View file

@ -73,10 +73,15 @@ if ($Options{'l'}) {
### get time period ### get time period
my ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'}); 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'}) {
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"); warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n");
$Options{'o'} = 'pretty'; $Options{'o'} = 'pretty';
}
}; };
### init database ### init database