* added an example guile script
This commit is contained in:
20
guile/examples/Makefile.am
Normal file
20
guile/examples/Makefile.am
Normal 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
30
guile/examples/mu-msg-stats
Executable 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)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user