From fce0a555f50737daf31ba2d3385bf9ab5f9b0c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 1 Jun 2020 13:58:21 +0200 Subject: Extend and document benchmark main. --- module/entry-points/benchmark.scm | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'module/entry-points/benchmark.scm') diff --git a/module/entry-points/benchmark.scm b/module/entry-points/benchmark.scm index 701d786b..0ff5556d 100644 --- a/module/entry-points/benchmark.scm +++ b/module/entry-points/benchmark.scm @@ -2,16 +2,38 @@ :export (main) :use-module (ice-9 getopt-long) + :use-module (util options) :use-module (util) :use-module (util app) ) (define opt-spec - '()) + `((field (value #t) + (description + (*TOP* + "Which field from the current app to force. Most heavy fields are defined in " + (i "(vcomponent)") "."))) + (enable-output (single-char #\o) + (description + (*TOP* + "Output is be default supressed, since many fields contain way to much data " + "to read. This turns it on again."))) + (help (single-char #\h) (description "Print this help.")))) + (define (main args) - (define opts (getopt-long args opt-spec)) + (define opts (getopt-long args (getopt-opt opt-spec))) + + (define field (and=> (option-ref opts 'field #f) string->symbol)) + + (when (option-ref opts 'help #f) + (print-arg-help opt-spec) + (throw 'return)) + + (unless field + (throw 'argument-error "Field `field' required.")) - (write (getf 'calendars app: (current-app))) -) + (aif (option-ref opts 'enable-output #f) + (write (getf field app: (current-app))) + (getf field app: (current-app)))) -- cgit v1.2.3