From 486ed5838bb3258b4bd1cb1d87534b048cecc8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 30 Dec 2021 17:29:39 +0100 Subject: Improve --help output. --- main.scm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/main.scm b/main.scm index d38e7ea..627fc50 100755 --- a/main.scm +++ b/main.scm @@ -64,24 +64,25 @@ (define option-spec `((output (single-char #\o) (required? #f) - (value #t)) - (help (single-char #\h)) + (value #t) + (description "Target directory for output files" (br) + "Defaults to " (i "$PWD") ".")) + (help (single-char #\h) + (description "Print this help")) (config-dir (required? #f) - (value #t)) - (quiet (value #f)))) + (value #t) + (description "Defaults to " (i "$XDG_CONFIG_DIR/rss-filter"))) + (quiet (value #f) + (description "Supress info output")))) -(define (display-help) - (format #t "Usage: ~a [--config-dir conf-dir] [--output /tmp/output]~%" - (car (command-line)))) - (define (display-no-config config-dir) (format #t "Configuration directory [~a] doesn't exist, or is unreadable~%" config-dir)) (define (main args) - (define opts (getopt-long args option-spec)) + (define opts (getopt-long args ((@ (calp util options) getopt-opt) option-spec))) (define output-directory (option-ref opts 'output ".")) (define config-dir @@ -92,7 +93,7 @@ (define quiet? (option-ref opts 'quiet #f)) (when (option-ref opts 'help #f) - (display-help) + ((@ (calp util options) print-arg-help) option-spec) (exit 0)) (unless (file-exists? config-dir) -- cgit v1.2.3