From 5aed5c23cece498ed86b1246f21b2f4ef9174268 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 2 Oct 2024 14:10:15 +0100 Subject: command-line-tool: Add local version of coerce-expression. * ravanan/command-line-tool.scm (coerce-expression-local): New function. --- ravanan/command-line-tool.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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{} objects for the @code{CommandLineTool} class workflow @var{cwl} and @var{inputs}. The -- cgit v1.2.3