summaryrefslogtreecommitdiff
path: root/guix/scripts/weather.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-21 22:58:19 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-22 00:09:42 +0200
commitb1903b99e0c5c654dc152f16c79b5a933d6a9435 (patch)
tree0d62d0034d41ac8e7a9ad8c10627a1460def9ed6 /guix/scripts/weather.scm
parent4e941436c798593d3bb62cbff8ba9a6c22f75339 (diff)
downloadguix-patches-b1903b99e0c5c654dc152f16c79b5a933d6a9435.tar
guix-patches-b1903b99e0c5c654dc152f16c79b5a933d6a9435.tar.gz
weather: Accept package specs on the command line.
Previously, non-option arguments would be ignored. Now it puts them to good use. * guix/scripts/weather.scm (guix-weather)[package-list]: New procedure. Use it. * doc/guix.texi (Invoking guix weather): Adjust accordingly.
Diffstat (limited to 'guix/scripts/weather.scm')
-rw-r--r--guix/scripts/weather.scm21
1 files changed, 16 insertions, 5 deletions
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 4b12f9550e..78b8674e0c 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -252,7 +252,7 @@ are queued~%")
;;;
(define (show-help)
- (display (G_ "Usage: guix weather [OPTIONS]
+ (display (G_ "Usage: guix weather [OPTIONS] [PACKAGES ...]
Report the availability of substitutes.\n"))
(display (G_ "
--substitute-urls=URLS
@@ -469,6 +469,20 @@ SERVER. Display information for packages with at least THRESHOLD dependents."
;;;
(define (guix-weather . args)
+ (define (package-list opts)
+ ;; Return the package list specified by OPTS.
+ (let ((file (assoc-ref opts 'manifest))
+ (base (filter-map (match-lambda
+ (('argument . spec)
+ (specification->package spec))
+ (_
+ #f))
+ opts)))
+ (if (and (not file) (null? base))
+ (all-packages)
+ (append base
+ (if file (load-manifest file) '())))))
+
(with-error-handling
(parameterize ((current-terminal-columns (terminal-columns)))
(let* ((opts (parse-command-line args %options
@@ -481,10 +495,7 @@ SERVER. Display information for packages with at least THRESHOLD dependents."
opts)
(() (list (%current-system)))
(systems systems)))
- (packages (let ((file (assoc-ref opts 'manifest)))
- (if file
- (load-manifest file)
- (all-packages))))
+ (packages (package-list opts))
(items (with-store store
(parameterize ((%graft? #f))
(concatenate