summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-27 13:11:26 -0700
committerLudovic Courtès <ludo@gnu.org>2017-10-27 13:11:26 -0700
commitefff3dd4c984f0c2e6f8cb63cf109a6c7b89dea0 (patch)
treedcee64eed801eb86aa8575d51c698506ace12a00
parent50942a690eb1845471348bd397b19da7d9d26879 (diff)
downloadguix-efff3dd4c984f0c2e6f8cb63cf109a6c7b89dea0.tar.gz
scripts: Use 'args-fold*' for command that do not honor build flags.
Fixes <https://bugs.gnu.org/28984>.
Reported by Eric Bavier.

* guix/scripts/challenge.scm (guix-challenge): Use 'args-fold*' instead
of 'parse-command-line'.
* guix/scripts/size.scm (guix-size): Likewise.
* guix/scripts/weather.scm (guix-weather): Likewise.
-rw-r--r--guix/scripts/challenge.scm7
-rw-r--r--guix/scripts/size.scm7
-rw-r--r--guix/scripts/weather.scm8
3 files changed, 18 insertions, 4 deletions
diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm
index e82d5351d8..5c59fbe21c 100644
--- a/guix/scripts/challenge.scm
+++ b/guix/scripts/challenge.scm
@@ -278,7 +278,12 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n"))
 
 (define (guix-challenge . args)
   (with-error-handling
-    (let* ((opts     (parse-command-line args %options (list %default-options)))
+    (let* ((opts     (args-fold* args %options
+                                 (lambda (opt name arg . rest)
+                                   (leave (G_ "~A: unrecognized option~%") name))
+                                 (lambda (arg result)
+                                   (alist-cons 'argument arg result))
+                                 %default-options))
            (files    (filter-map (match-lambda
                                    (('argument . file) file)
                                    (_ #f))
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index eade184e67..dee3604174 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -291,7 +291,12 @@ Report the size of PACKAGE and its dependencies.\n"))
 
 (define (guix-size . args)
   (with-error-handling
-    (let* ((opts     (parse-command-line args %options (list %default-options)))
+    (let* ((opts     (args-fold* args %options
+                                 (lambda (opt name arg . rest)
+                                   (leave (G_ "~A: unrecognized option~%") name))
+                                 (lambda (arg result)
+                                   (alist-cons 'argument arg result))
+                                 %default-options))
            (files    (filter-map (match-lambda
                                    (('argument . file) file)
                                    (_ #f))
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 4c4dfac8f6..7f42f9475d 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -204,8 +204,12 @@ Report the availability of substitutes.\n"))
 
 (define (guix-weather . args)
   (with-error-handling
-    (let* ((opts     (parse-command-line args %options
-                                         (list %default-options)))
+    (let* ((opts     (args-fold* args %options
+                                 (lambda (opt name arg . rest)
+                                   (leave (G_ "~A: unrecognized option~%") name))
+                                 (lambda (arg result)
+                                   (alist-cons 'argument arg result))
+                                 %default-options))
            (urls     (assoc-ref opts 'substitute-urls))
            (systems  (match (filter-map (match-lambda
                                           (('system . system) system)