summary refs log tree commit diff
diff options
context:
space:
mode:
authorzimoun <zimon.toutoune@gmail.com>2021-03-29 12:18:01 +0200
committerLudovic Courtès <ludo@gnu.org>2021-04-01 14:58:54 +0200
commitd8382d1ef63e8188efe60df84f78aeed449b4c67 (patch)
tree3047f372d6edeaf49f6959a3456c3cf1a0d03cc1
parent8e4ca1b1d0c3200d54f57fcc2497a0f56a580dea (diff)
downloadguix-d8382d1ef63e8188efe60df84f78aeed449b4c67.tar.gz
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>
-rw-r--r--guix/scripts/download.scm17
1 files changed, 8 insertions, 9 deletions
diff --git a/guix/scripts/download.scm b/guix/scripts/download.scm
index ce8dd8b02c..5a91390358 100644
--- a/guix/scripts/download.scm
+++ b/guix/scripts/download.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; 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.
 ;;;
@@ -162,15 +163,13 @@ and 'base16' ('hex' and 'hexadecimal' can be used as well).\n"))
 
   (define (parse-options)
     ;; Return the alist of option values.
-    (args-fold* args %options
-                (lambda (opt name arg result)
-                  (leave (G_ "~A: unrecognized option~%") name))
-                (lambda (arg result)
-                  (when (assq 'argument result)
-                    (leave (G_ "~A: extraneous argument~%") arg))
-
-                  (alist-cons 'argument arg result))
-                %default-options))
+    (parse-command-line args %options (list %default-options)
+                        #:build-options? #f
+                        #:argument-handler
+                        (lambda (arg result)
+                          (when (assq 'argument result)
+                            (leave (G_ "~A: extraneous argument~%") arg))
+                          (alist-cons 'argument arg result))))
 
   (with-error-handling
     (let* ((opts  (parse-options))