summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2024-09-05 17:00:33 +0100
committerArun Isaac2024-09-05 17:00:33 +0100
commit6b41a04baa5c2ca06c87ef4911dd67ecf73b2824 (patch)
tree7634dc3f5af3e05ab484b7f0b94f6a6f51e0564a
parentdee8227273738261c910d545c5006aefe096b0b4 (diff)
downloadravanan-6b41a04baa5c2ca06c87ef4911dd67ecf73b2824.tar.gz
ravanan-6b41a04baa5c2ca06c87ef4911dd67ecf73b2824.tar.lz
ravanan-6b41a04baa5c2ca06c87ef4911dd67ecf73b2824.zip
command-line-tool: Refactor glob extraction into separate function.
*
ravanan/command-line-tool.scm (build-command-line-tool-script)[output-binding-glob]:
New function.
[capture-outputs-gexp]: Use output-binding-glob.
-rw-r--r--ravanan/command-line-tool.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 5503dd3..47b3903 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -699,6 +699,12 @@ named @var{name} with @var{inputs} using tools from Guix manifest
       #~(file-name-join* stdout-directory "stdout"))
      (else #f)))
 
+  (define (output-binding-glob output)
+    (from-maybe
+     (maybe-assoc-ref (just output)
+                      "outputBinding" "glob")
+     (raise-error #f "glob output binding not specified")))
+
   (define run-command-gexp
     #~(run-command (list #$@(append-map (lambda (arg)
                                           (if (command-line-binding? arg)
@@ -761,11 +767,7 @@ named @var{name} with @var{inputs} using tools from Guix manifest
                                             other-outputs)
                                     '#$(map (cut assoc-ref <> "type")
                                             other-outputs)
-                                    '#$(map (lambda (output)
-                                              (from-maybe
-                                               (maybe-assoc-ref (just output)
-                                                                "outputBinding" "glob")
-                                               (raise-error #f "glob output binding not specified")))
+                                    '#$(map output-binding-glob
                                             other-outputs)))))
              out
              #:pretty #t)