[7/7] guix import: Print list of expressions.
Commit Message
* guix/scripts/import.scm (guix-import): Print list of expressions.
---
guix/scripts/import.scm | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
Comments
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’.
@@ -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)))))