upgrade: Allow several regexps.

Fixes <https://bugs.gnu.org/44928>.
Reported by Luis Felipe <luis.felipe.la@protonmail.com>.

* guix/scripts/upgrade.scm (guix-upgrade): Allow several regexps and remove
"extraneous arguement" check.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
zimoun 2020-11-28 21:32:45 +01:00 committed by Mathieu Othacehe
parent dcb95c6fc1
commit 86971616c1
No known key found for this signature in database
GPG key ID: 8354763531769CA6

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@ -74,15 +75,10 @@ (define-command (guix-upgrade . args)
(synopsis "upgrade packages to their latest version")
(define (handle-argument arg result arg-handler)
;; Accept at most one non-option argument, and treat it as an upgrade
;; regexp.
(match (assq-ref result 'upgrade)
(#f
(values (alist-cons 'upgrade arg
(alist-delete 'upgrade result))
arg-handler))
(_
(leave (G_ "~A: extraneous argument~%") arg))))
;; Treat non-option arguments as upgrade regexps.
(values (alist-cons 'upgrade arg
(delete '(upgrade . #f) result))
arg-handler))
(define opts
(parse-command-line args %options