aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorArun Isaac2021-10-12 14:56:59 +0530
committerArun Isaac2021-10-12 16:15:47 +0530
commitc3077419d1a6dc2a735fb3408aaf4842a46ea833 (patch)
tree7a62185c6bf29241849635ce03312d1c1097c8cb /scripts
parentdb3c13ce159060d57364dcafbbafc6ec52ece981 (diff)
downloadccwl-c3077419d1a6dc2a735fb3408aaf4842a46ea833.tar.gz
ccwl-c3077419d1a6dc2a735fb3408aaf4842a46ea833.tar.lz
ccwl-c3077419d1a6dc2a735fb3408aaf4842a46ea833.zip
scripts: Use args-fold.
* scripts/ccwl.in: Import (srfi srfi-37). (invalid-option): New function. (main): Use args-fold to extract source filename.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ccwl.in24
1 files changed, 17 insertions, 7 deletions
diff --git a/scripts/ccwl.in b/scripts/ccwl.in
index 8093fa9..ec5aa32 100755
--- a/scripts/ccwl.in
+++ b/scripts/ccwl.in
@@ -25,18 +25,28 @@
;;; Code:
-(use-modules (ice-9 match)
+(use-modules (srfi srfi-37)
+ (ice-9 match)
(ccwl ccwl)
(ccwl cwl))
+(define (invalid-option opt name arg result)
+ (error "Invalid option" name))
+
(define main
(match-lambda*
- ((_ "compile" input-file)
- ;; FIXME: Compiling ccwl files fails since the workflow macro is
- ;; unable to access command definitions.
- (set! %load-should-auto-compile #f)
- (workflow->cwl (load (canonicalize-path input-file))
- (current-output-port)))
+ ((_ "compile" args ...)
+ (let* ((args (args-fold args
+ '()
+ invalid-option
+ (lambda (arg result)
+ (acons 'source-file arg result))
+ '())))
+ ;; FIXME: Compiling ccwl files fails since the workflow macro is
+ ;; unable to access command definitions.
+ (set! %load-should-auto-compile #f)
+ (workflow->cwl (load (canonicalize-path (assq-ref args 'source-file)))
+ (current-output-port))))
((program _ ...)
(format (current-error-port)
"Usage: ~a compile input-file~%"