From 43d66ffa64933ec1a6e521355423c0cc9f5442e0 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 17 Dec 2025 22:19:23 +0000 Subject: work/command-line-tool: Do not assume valueFrom evaluate to strings. valueFrom can have expressions that evaluate to numbers, booleans, arrays, or indeed any other type. --- ravanan/work/command-line-tool.scm | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm index b64fcad..488aba2 100644 --- a/ravanan/work/command-line-tool.scm +++ b/ravanan/work/command-line-tool.scm @@ -38,7 +38,6 @@ unsupported-uri-scheme? unsupported-uri-scheme-scheme - value->string call-with-current-directory object-type match-type @@ -67,12 +66,6 @@ unsupported-uri-scheme unsupported-uri-scheme? (scheme unsupported-uri-scheme-scheme)) -(define (value->string x) - "Convert value @var{x} to a string." - (cond - ((number? x) (number->string x)) - (else x))) - (define (call-with-current-directory curdir thunk) "Call THUNK with current directory set to CURDIR. Restore current directory after THUNK returns." @@ -359,14 +352,15 @@ the G-expressions are inserted." G-expressions may reference @var{inputs} and @var{runtime} variables that must be defined in the context in which the G-expressions are inserted." (define (argument->command-line-binding i argument) - (command-line-binding (cond - ((assoc-ref argument "position") - => string->number) - (else i)) - (maybe-assoc-ref (just argument) "prefix") - 'string - (value->string (assoc-ref* argument "valueFrom")) - %nothing)) + (let ((value (assoc-ref* argument "valueFrom"))) + (command-line-binding (cond + ((assoc-ref argument "position") + => string->number) + (else i)) + (maybe-assoc-ref (just argument) "prefix") + (object-type value) + value + %nothing))) (define (collect-bindings ids+inputs+types+bindings) (append-map id+input+type-tree+binding->command-line-binding -- cgit 1.4.1