diff options
| author | Arun Isaac | 2025-12-01 23:50:24 +0000 |
|---|---|---|
| committer | Arun Isaac | 2025-12-01 23:50:24 +0000 |
| commit | 7287162ffc4b2cd9740cec84f5e34a03ad52e4b6 (patch) | |
| tree | 35191140be4af46eb504bce6902e8e5836b7daf7 /scripts | |
| parent | badcc3df8488c95359d30f907c8da043fcc0c455 (diff) | |
| download | ccwl-7287162ffc4b2cd9740cec84f5e34a03ad52e4b6.tar.gz ccwl-7287162ffc4b2cd9740cec84f5e34a03ad52e4b6.tar.lz ccwl-7287162ffc4b2cd9740cec84f5e34a03ad52e4b6.zip | |
scripts: Move options to separate variable.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/ccwl | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/scripts/ccwl b/scripts/ccwl index 984d22a..22c6162 100755 --- a/scripts/ccwl +++ b/scripts/ccwl @@ -3,7 +3,7 @@ exec guile --no-auto-compile -e main -s "$0" "$@" !# ;;; ccwl --- Concise Common Workflow Language -;;; Copyright © 2021–2024 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2021–2025 Arun Isaac <arunisaac@systemreboot.net> ;;; ;;; This file is part of ccwl. ;;; @@ -49,6 +49,23 @@ exec guile --no-auto-compile -e main -s "$0" "$@" (lambda (opt name arg result) (acons 'help #t result)))) +(define %options + (list (option (list #\t "to") #t #f + (lambda (opt name arg result) + (let ((supported (list "cwl" "dot"))) + (unless (member arg supported) + (scm-error 'misc-error + #f + "Invalid target ~A argument ~S. Supported targets are ~A." + (list (if (char? name) + (string #\- name) + (string-append "--" name)) + arg + (string-join supported ", ")) + #f))) + (acons 'to arg result))) + %help-option)) + (define (main args) (with-exception-handler (lambda (condition) @@ -75,21 +92,7 @@ Thank you! (match args ((program "compile" args ...) (let* ((args (args-fold args - (list (option (list #\t "to") #t #f - (lambda (opt name arg result) - (let ((supported (list "cwl" "dot"))) - (unless (member arg supported) - (scm-error 'misc-error - #f - "Invalid target ~A argument ~S. Supported targets are ~A." - (list (if (char? name) - (string #\- name) - (string-append "--" name)) - arg - (string-join supported ", ")) - #f))) - (acons 'to arg result))) - %help-option) + %options invalid-option (lambda (arg result) (acons 'source-file arg result)) |
