diff mbox

[7/7] guix import: Print list of expressions.

Message ID 1464018008-1767-8-git-send-email-ricardo.wurmus@mdc-berlin.de
State New
Headers show

Commit Message

Ricardo Wurmus May 23, 2016, 3:40 p.m. UTC
* guix/scripts/import.scm (guix-import): Print list of expressions.
---
 guix/scripts/import.scm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Ludovic Courtès May 30, 2016, 8:56 a.m. UTC | #1
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> * guix/scripts/import.scm (guix-import): Print list of expressions.

Depending on your answer to #6, maybe we’d bring more of the recursive
functionality to this file.  :-)

Anyway, this is a step in the right direction, thanks for working on it!

Ludo’.
diff mbox

Patch

diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index e54744f..5cda3dd 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -107,10 +107,14 @@  Run IMPORTER with ARGS.\n"))
      (show-version-and-exit "guix import"))
     ((importer args ...)
      (if (member importer importers)
-         (match (apply (resolve-importer importer) args)
-           ((and expr ('package _ ...))
-            (pretty-print expr (newline-rewriting-port
-                                (current-output-port))))
-           (x
-            (leave (_ "'~a' import failed~%") importer)))
+         (let ((print (lambda (expr)
+                        (pretty-print expr (newline-rewriting-port
+                                            (current-output-port))))))
+           (match (apply (resolve-importer importer) args)
+             ((and expr ('package _ ...))
+              (print expr))
+             ((? list? expressions)
+              (for-each print expressions))
+             (x
+              (leave (_ "'~a' import failed~%") importer))))
          (leave (_ "~a: invalid importer~%") importer)))))