scripts: download: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/download.scm (define-command): Replace 'args-fold*' by 'parse-command-line'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
8e4ca1b1d0
commit
d8382d1ef6
1 changed files with 8 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -162,15 +163,13 @@ and 'base16' ('hex' and 'hexadecimal' can be used as well).\n"))
|
||||||
|
|
||||||
(define (parse-options)
|
(define (parse-options)
|
||||||
;; Return the alist of option values.
|
;; Return the alist of option values.
|
||||||
(args-fold* args %options
|
(parse-command-line args %options (list %default-options)
|
||||||
(lambda (opt name arg result)
|
#:build-options? #f
|
||||||
(leave (G_ "~A: unrecognized option~%") name))
|
#:argument-handler
|
||||||
(lambda (arg result)
|
(lambda (arg result)
|
||||||
(when (assq 'argument result)
|
(when (assq 'argument result)
|
||||||
(leave (G_ "~A: extraneous argument~%") arg))
|
(leave (G_ "~A: extraneous argument~%") arg))
|
||||||
|
(alist-cons 'argument arg result))))
|
||||||
(alist-cons 'argument arg result))
|
|
||||||
%default-options))
|
|
||||||
|
|
||||||
(with-error-handling
|
(with-error-handling
|
||||||
(let* ((opts (parse-options))
|
(let* ((opts (parse-options))
|
||||||
|
|
Reference in a new issue