* guile: some update for the output format

This commit is contained in:
djcb
2013-07-23 22:22:57 +03:00
parent b7324d5af6
commit b7219aaf82
3 changed files with 29 additions and 23 deletions

View File

@ -19,18 +19,19 @@ exec guile -e main -s $0 $@
;; along with this program; if not, write to the Free Software Foundation,
;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;; INFO: graph the number of messages per day
;; INFO: graph the number of messages per day (using gnuplot)
;; INFO: options:
;; INFO: --query=<query>: limit to messages matching query
;; INFO: --muhome=<muhome>: path to mu home dir
;; INFO: --textonly: output in text-only format
;; INFO: --output: the output format, such as "png", "wxt"
;; INFO: (depending on the environment)
(use-modules (mu) (mu script) (mu stats) (mu plot))
(define (per-day expr text-only)
(define (per-day expr output)
"Count the total number of messages for each weekday (0-6 for
Sun..Sat) that match EXPR. If PLAIN-TEXT is true, use a plain-text
display, otherwise, use a graphical window."
Sun..Sat) that match EXPR. OUTPUT corresponds to the output format, as
per gnuplot's 'set terminal'."
(mu:plot-histogram
(mu:weekday-numbers->names
(sort (mu:tabulate
@ -38,7 +39,7 @@ display, otherwise, use a graphical window."
(tm:wday (localtime (mu:date msg)))) expr)
(lambda (x y) (< (car x) (car y)))))
(format #f "Messages per weekday matching ~a" expr)
"Day" "Messages" text-only))
"Day" "Messages" output))
(define (main args)
(mu:run-stats args per-day))