diff options
author | Pjotr Prins | 2025-01-01 07:33:51 -0600 |
---|---|---|
committer | Pjotr Prins | 2025-01-01 07:33:51 -0600 |
commit | 8338631464da191d937bb305a2bed4f3fa4c771e (patch) | |
tree | e623f7bc968fb4371ffac6f62266a377443caf05 | |
parent | 2089148bfc715b0d9a34be43836f525e70311090 (diff) | |
download | pangemma-8338631464da191d937bb305a2bed4f3fa4c771e.tar.gz |
Handle command line parameters
-rwxr-xr-x | bin/pangemma | 22 |
1 files 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 +")))) |