From bccb228031aaaddac8e5ed2b1b90a8049cc70fea Mon Sep 17 00:00:00 2001
From: Matt Taggart <taggart@riseup.net>
Date: Mon, 4 Nov 2019 09:49:35 -0800
Subject: [PATCH] add a CSV output format for importing into spreadsheets

---
 tools/stats/topvolume | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/stats/topvolume b/tools/stats/topvolume
index f0e330a..115eb13 100755
--- a/tools/stats/topvolume
+++ b/tools/stats/topvolume
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# toplists - top $num lists and their volume / size, sorted descending by volume
+# topvolume - top $num lists and their volume/size, sorted descending by volume
 # NOTE: this script requires the current user has read access to the db and arc/
 
 $num=25;
@@ -25,6 +25,11 @@ format Plain =
 $volume, $subscribers, $list, $lang
 .
 
+format CSV =
+@*,@*,@*,@*
+$volume, $subscribers, $list, $lang
+.
+
 format Html =
 <tr><td><a href="https://lists.riseup.net/www/info/@*">@*</a></td><td align=right><a href=https://lists.riseup.net/www/arc/">@*</a></td><td><a href=https://lists.riseup.net/www/review/">@*</a></td><td>@*</td></tr>
                                                 $list, $list, $list, $volume, $list, $subscribers, $lang
@@ -49,6 +54,9 @@ if ( $ARGV[0] eq '-w' ) {
   print "<tr><th align=center>List name</th><th align=center>Volume</th><th>Subscribers</th></tr>\n";
 } elsif ($ARGV[0] eq '-r' ) {
   $~='Pcre';
+} elsif ($ARGV[0] eq '-c' ) {
+  print "Volume,Subscribers,List name,Lang\n";
+  $~='CSV';
 } else {
   $~='Plain';
   print "Top $num lists by monthly volume\n";
-- 
GitLab