aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccwl/ccwl.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index 789e39e..4760fb6 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -205,3 +205,31 @@
(out . ,(list->vector (step-out step)))
(run . ,(step-run step))))
steps))))
+(define (output->cwl output)
+ `(,(output-id output)
+ ,@(filter identity
+ (list (and (output-type output)
+ (cons 'type (output-type output)))
+ (and (output-binding output)
+ (cons 'output-binding (output-binding output)))))
+ ,@(output-other output)))
+
+(define (command->cwl command)
+ `((cwl-version . "v1.1")
+ (class . Command-line-tool)
+ ,@(command-other command)
+ (arguments . ,(list->vector (map (lambda (arg)
+ (if (input? arg)
+ (string-append "$(inputs." (input-id arg) ")")
+ arg))
+ (command-args command))))
+ (inputs . ,(map input->tree (append (command-inputs command)
+ (if (command-stdin command)
+ (list (command-stdin command))
+ (list)))))
+ (outputs . ,(map output->cwl (command-outputs command)))
+ ,@(if (command-stdin command)
+ `((stdin . ,(string-append "$(inputs."
+ (input-id (command-stdin command))
+ ".path)")))
+ '())))