diff options
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)) |
