aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-10-02 14:10:15 +0100
committerArun Isaac2024-10-02 14:11:43 +0100
commit5aed5c23cece498ed86b1246f21b2f4ef9174268 (patch)
tree047374d510861f6e8b7f1d26904ab8e28fdd0f1f
parent234e501596d1c6ad6f48bb5f5f337d3617f68176 (diff)
downloadravanan-5aed5c23cece498ed86b1246f21b2f4ef9174268.tar.gz
ravanan-5aed5c23cece498ed86b1246f21b2f4ef9174268.tar.lz
ravanan-5aed5c23cece498ed86b1246f21b2f4ef9174268.zip
command-line-tool: Add local version of coerce-expression.
* ravanan/command-line-tool.scm (coerce-expression-local): New function.
-rw-r--r--ravanan/command-line-tool.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 55f6bb3..e70969c 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -214,6 +214,24 @@ evaluates it. This G-expression references variables @code{inputs} and
(list))
expression))
+(define (coerce-expression-local expression inputs)
+ "Coerce @var{expression}, which may reference @var{inputs}, into a scheme JSON
+tree.
+
+When @var{expression} is a scheme JSON tree, return it as is. When
+@var{expression} is a javascript expression, evaluate it and return the result.
+This function is similar to @code{coerce-expression-local}, but executes locally
+instead of staging onto a G-expression."
+ (if (and (string? expression)
+ (javascript-expression? expression))
+ (evaluate-parameter-reference %node
+ (interpolate-parameter-references expression)
+ inputs
+ 'null
+ (list)
+ (list))
+ expression))
+
(define (build-command cwl inputs)
"Return a list of @code{<command-line-binding>} objects for the
@code{CommandLineTool} class workflow @var{cwl} and @var{inputs}. The