* added an example guile script

This commit is contained in:
djcb
2011-12-14 09:12:10 +02:00
parent f55affe45e
commit 71b01c6ff2
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,20 @@
## Copyright (C) 2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software Foundation,
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
include $(top_srcdir)/gtest.mk
noinst_DIST= \
mu-msg-stats

30
guile/examples/mu-msg-stats Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
exec guile -e main -s $0 $@
!#
(use-modules (mu) (mu stats))
(define (main args)
(define (usage-exit)
(display "usage: mu-msg-stats hour|day|month|year [searchexpr]")
(newline)
(exit 1))
(if (not (>= (length args) 2))
(usage-exit))
(mu:init)
(let* ((lst (cdr (cdr args)))
(expr (if lst (string-join lst) "")))
(display expr)
(newline)
(cond
((string= (cadr args) "hour") (mu:plot:per-hour expr))
((string= (cadr args) "day") (mu:plot:per-weekday expr))
((string= (cadr args) "month") (mu:plot:per-month expr))
((string= (cadr args) "year") (mu:plot:per-year expr))
(else (usage-exit)))))