rekado pushed a commit to branch master
in repository guix.
commit 4f353c485dea4b549a0aabd1c87b0dd03fef4f1e
Author: Ricardo Wurmus <[email protected]>
AuthorDate: Tue Apr 14 18:02:26 2020 +0200
scripts/package: Handle JSON files.
* guix/scripts/package.scm (%options): Support loading from JSON files when
"install-from-file" is used.
---
guix/scripts/package.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index badb1dc..4044583 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2016 Benz Schenk <[email protected]>
;;; Copyright © 2016 Chris Marusich <[email protected]>
;;; Copyright © 2019 Tobias Geerinckx-Rice <[email protected]>
+;;; Copyright © 2020 Ricardo Wurmus <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -33,6 +34,7 @@
#:use-module (guix packages)
#:use-module (guix profiles)
#:use-module (guix search-paths)
+ #:use-module (guix import json)
#:use-module (guix monads)
#:use-module (guix utils)
#:use-module (guix config)
@@ -418,7 +420,10 @@ Install, remove, or upgrade packages in a single
transaction.\n"))
(option '(#\f "install-from-file") #t #f
(lambda (opt name arg result arg-handler)
(values (alist-cons 'install
- (load* arg (make-user-module '()))
+ (let ((file (or (and (string-suffix?
".json" arg)
+ (json->scheme-file
arg))
+ arg)))
+ (load* file (make-user-module '())))
result)
#f)))
(option '(#\r "remove") #f #t