diff options
author | Arun Isaac | 2021-03-06 02:04:46 +0530 |
---|---|---|
committer | Arun Isaac | 2021-03-06 02:12:05 +0530 |
commit | 1f421c635d773dd09e8719ee7a23fed2bbfba531 (patch) | |
tree | f40d6a11e013575262c7e89bcc68ba6a6d66326f | |
parent | 02ff0322917f85be7b75a3d9f94076398b9d846a (diff) | |
download | ccwl-1f421c635d773dd09e8719ee7a23fed2bbfba531.tar.gz ccwl-1f421c635d773dd09e8719ee7a23fed2bbfba531.tar.lz ccwl-1f421c635d773dd09e8719ee7a23fed2bbfba531.zip |
Add command->cwl rendering function.
* ccwl/ccwl.scm (output->cwl, command->cwl): New functions.
-rw-r--r-- | ccwl/ccwl.scm | 28 |
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)"))) + '()))) |