summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-22 10:51:17 +0300
committerAlex Kost <alezost@gmail.com>2015-10-27 21:54:57 +0300
commit6ffa706b6d80265b2fd244484b42492a71a2ef31 (patch)
treeae40d76337f5b4aaad65565710d13c0c5ea79d6e
parent7e6b490d041935d0f77de3cee0493707435a34d6 (diff)
downloadguix-6ffa706b6d80265b2fd244484b42492a71a2ef31.tar.gz
refresh: Add '--list-updaters' option.
* guix/scripts/refresh.scm (list-updaters-and-exit): New procedure.
  (%options, show-help): Add '--list-updaters' option.
* doc/guix.texi (Invoking guix refresh): Document it.
-rw-r--r--doc/guix.texi4
-rw-r--r--guix/scripts/refresh.scm16
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 20bf28424e..1bb7125fa2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4305,6 +4305,10 @@ be used when passing @command{guix refresh} one or more package names:
 
 @table @code
 
+@item --list-updaters
+@itemx -L
+List available updaters and exit (see @option{--type} above.)
+
 @item --list-dependent
 @itemx -l
 List top-level dependent packages that would need to be rebuilt as a
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 6f7ca4a41b..a66b3f9ea8 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,6 +70,9 @@
         (option '(#\t "type") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'updater (string->symbol arg) result)))
+        (option '(#\L "list-updaters") #f #f
+                (lambda args
+                   (list-updaters-and-exit)))
         (option '(#\l "list-dependent") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'list-dependent? #t result)))
@@ -112,6 +116,8 @@ specified with `--select'.\n"))
   (display (_ "
   -t, --type=UPDATER     restrict to updates from UPDATER--e.g., 'gnu'"))
   (display (_ "
+  -L, --list-updaters    list available updaters and exit"))
+  (display (_ "
   -l, --list-dependent   list top-level dependent packages that would need to
                          be rebuilt as a result of upgrading PACKAGE..."))
   (newline)
@@ -149,6 +155,16 @@ specified with `--select'.\n"))
           (eq? name (upstream-updater-name updater)))
         %updaters))
 
+(define (list-updaters-and-exit)
+  "Display available updaters and exit."
+  (format #t (_ "Available updaters:~%"))
+  (for-each (lambda (updater)
+              (format #t "- ~a: ~a~%"
+                      (upstream-updater-name updater)
+                      (_ (upstream-updater-description updater))))
+            %updaters)
+  (exit 0))
+
 (define* (update-package store package updaters
                          #:key (key-download 'interactive))
   "Update the source file that defines PACKAGE with the new version.