From 8338631464da191d937bb305a2bed4f3fa4c771e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 1 Jan 2025 07:33:51 -0600 Subject: Handle command line parameters --- bin/pangemma | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/pangemma b/bin/pangemma index 414107b..399ed6f 100755 --- a/bin/pangemma +++ b/bin/pangemma @@ -4,11 +4,25 @@ exec guile --no-auto-compile -e main -s "$0" "$@" !# (use-modules (ice-9 match) + (ice-9 getopt-long) (srfi srfi-9) (srfi srfi-9 gnu)) (define (main args) - (begin - (display "hello") - (newline) - )) + (let* [ + (option-spec '( (version (single-char #\v) (value #f)) + (id (value #t)) + (help (single-char #\h) (value #f)))) + (options (getopt-long args option-spec)) + (show-version (option-ref options 'version #f)) + (help-wanted (option-ref options 'help #f))] + (if show-version + (begin + (display "pangemma version 0.01\n") + (exit))) + (if help-wanted + (format #t "pangemma +Usage: pangemma [options...] filename(s) + -v --version Display version + -h --help Display this help +")))) -- cgit v1.2.3