From 37b9bbb7c7b4766547defd222be23b74efdd7cc9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 17 Apr 2025 19:55:01 +0100 Subject: command-line-tool: Abstract out file staging into its own function. * ravanan/command-line-tool.scm (build-command-line-tool-script)[stage-file]: New function. [stage-files]: Use stage-file. --- ravanan/command-line-tool.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index 6843ff5..51f14c2 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -988,6 +988,13 @@ directory of the workflow." ((eq? matched-type 'null) 'null)))))) + (define (stage-file file entry-name) + ;; Stage file as entry-name and return the staged File value. + (rename-file (assoc-ref* file "path") + entry-name) + (canonicalize-file-value `(("class" . "File") + ("path" . ,entry-name)))) + ;; Stage files. ;; We currently support File and Dirent only. TODO: Support others. (define (stage-files entries outputs-directory) @@ -1005,12 +1012,8 @@ directory of the workflow." ((eq? (object-type entry) 'File) ;; TODO: Stage secondary files too? - (rename-file (assoc-ref* entry "path") - entry-name) (cons entry - (canonicalize-file-value - `(("class" . "File") - ("path" . ,entry-name)))))))) + (stage-file entry entry-name)))))) entries)) (define (set-staged-path input staging-mapping) -- cgit v1.2.3