guix import: Print list of expressions.

* guix/scripts/import.scm (guix-import): Print list of expressions.
This commit is contained in:
Ricardo Wurmus 2016-05-17 16:42:41 +02:00 committed by Ricardo Wurmus
parent 64ce53eb5e
commit d68ba5f483
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC

@ -107,10 +107,17 @@ 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 (lambda (expr)
(print expr)
(newline))
expressions))
(x
(leave (_ "'~a' import failed~%") importer))))
(leave (_ "~a: invalid importer~%") importer)))))