From a5975cedf27b3cb149629fe16846a6aeff17a96b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2013 16:46:39 +0200 Subject: ui: Add `args-fold*' and use it. * guix/ui.scm (args-fold*): New procedure. * guix/scripts/build.scm, guix/scripts/download.scm, guix/scripts/gc.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/package.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm: Use `args-fold*' instead of `args-fold'. --- guix/scripts/build.scm | 12 ++++++------ guix/scripts/download.scm | 12 ++++++------ guix/scripts/gc.scm | 12 ++++++------ guix/scripts/hash.scm | 14 +++++++------- guix/scripts/import.scm | 12 ++++++------ guix/scripts/package.scm | 12 ++++++------ guix/scripts/pull.scm | 12 ++++++------ guix/scripts/refresh.scm | 12 ++++++------ 8 files changed, 49 insertions(+), 49 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 0bf154dd41..4464d84dfc 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -149,12 +149,12 @@ (define %options (define (guix-build . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (alist-cons 'argument arg result)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) (define (register-root paths root) ;; Register ROOT as an indirect GC root for all of PATHS. diff --git a/guix/scripts/download.scm b/guix/scripts/download.scm index 220211e6b8..da5fa5be9e 100644 --- a/guix/scripts/download.scm +++ b/guix/scripts/download.scm @@ -90,12 +90,12 @@ (define fmt-proc (define (guix-download . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (alist-cons 'argument arg result)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) (with-error-handling (let* ((opts (parse-options)) diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 7625bc46e6..cecb68ec36 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -141,12 +141,12 @@ (define %options (define (guix-gc . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (alist-cons 'argument arg result)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) (define (symlink-target file) (let ((s (false-if-exception (lstat file)))) diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index ad05a4e66f..deded63136 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -90,13 +90,13 @@ (define fmt-proc (define (guix-hash . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "unrecognized option: ~a~%") - name)) - (lambda (arg result) - (alist-cons 'argument arg result)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "unrecognized option: ~a~%") + name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) (let* ((opts (parse-options)) (args (filter-map (match-lambda diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 0b95afced1..6f75017d6e 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -95,12 +95,12 @@ (define %options (define (guix-import . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (alist-cons 'argument arg result)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) (let* ((opts (parse-options)) (args (filter-map (match-lambda diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index c5656efc14..cea49a57f4 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -446,12 +446,12 @@ (define %options (define (guix-package . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (leave (_ "~A: extraneous argument~%") arg)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (leave (_ "~A: extraneous argument~%") arg)) + %default-options)) (define (guile-missing?) ;; Return #t if %GUILE-FOR-BUILD is not available yet. diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index f99e8c1e3d..f4135efc99 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -173,12 +173,12 @@ (define %options (define (guix-pull . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (leave (_ "~A: unexpected argument~%") arg)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (leave (_ "~A: unexpected argument~%") arg)) + %default-options)) (with-error-handling (let ((opts (parse-options)) diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index da318b07ad..6584282f93 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -93,12 +93,12 @@ (define (show-help) (define (guix-refresh . args) (define (parse-options) ;; Return the alist of option values. - (args-fold args %options - (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (alist-cons 'argument arg result)) - %default-options)) + (args-fold* args %options + (lambda (opt name arg result) + (leave (_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) (define core-package? (let* ((input->package (match-lambda -- cgit v1.2.3