* [bug#47464] [PATCH 2/8] scripts: discover: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
@ 2021-03-29 10:18 ` zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 3/8] scripts: download: " zimoun
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/discover.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/discover.scm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/guix/scripts/discover.scm b/guix/scripts/discover.scm
index 6aade81ed1..be1eaa6e95 100644
--- a/guix/scripts/discover.scm
+++ b/guix/scripts/discover.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -127,12 +128,11 @@ to synchronize with the writer."
(synopsis "discover Guix related services using Avahi")
(with-error-handling
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (leave (G_ "~A: extraneous argument~%") arg))
- %default-options))
+ (let* ((opts (parse-command-line args %options (list %default-options)
+ #:build-options? #f
+ #:argument-handler
+ (lambda (arg result)
+ (leave (G_ "~A: extraneous argument~%") arg))))
(cache (assoc-ref opts 'cache))
(publish-file (publish-file cache)))
(parameterize ((%publish-file publish-file))
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#47464] [PATCH 3/8] scripts: download: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 2/8] scripts: discover: " zimoun
@ 2021-03-29 10:18 ` zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 4/8] scripts: edit: " zimoun
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/download.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/download.scm | 17 ++++++++---------
1 file 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))
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#47464] [PATCH 4/8] scripts: edit: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 2/8] scripts: discover: " zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 3/8] scripts: download: " zimoun
@ 2021-03-29 10:18 ` zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 5/8] scripts: publish: " zimoun
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/edit.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/edit.scm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/guix/scripts/edit.scm b/guix/scripts/edit.scm
index 49c9d945b6..b4c0507591 100644
--- a/guix/scripts/edit.scm
+++ b/guix/scripts/edit.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mathieu Lirzin <mthl@gnu.org>
-;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2020, 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -84,11 +84,9 @@ line."
(define (parse-arguments)
;; Return the list of package names.
- (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
- cons
- '()))
+ (parse-command-line args %options (list (list))
+ #:build-options? #f
+ #:argument-handler cons))
(with-error-handling
(let* ((specs (reverse (parse-arguments)))
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#47464] [PATCH 5/8] scripts: publish: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
` (2 preceding siblings ...)
2021-03-29 10:18 ` [bug#47464] [PATCH 4/8] scripts: edit: " zimoun
@ 2021-03-29 10:18 ` zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 6/8] scripts: repl: " zimoun
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/publish.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/publish.scm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index fa85088ed0..39bb224cad 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2020 by Amar M. Singh <nly@disroot.org>
;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1117,12 +1118,11 @@ methods, return the applicable compression."
(synopsis "publish build results over HTTP")
(with-error-handling
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (leave (G_ "~A: extraneous argument~%") arg))
- %default-options))
+ (let* ((opts (parse-command-line args %options (list %default-options)
+ #:build-options? #f
+ #:argument-handler
+ (lambda (arg result)
+ (leave (G_ "~A: extraneous argument~%") arg))))
(advertise? (assoc-ref opts 'advertise?))
(user (assoc-ref opts 'user))
(port (assoc-ref opts 'port))
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#47464] [PATCH 6/8] scripts: repl: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
` (3 preceding siblings ...)
2021-03-29 10:18 ` [bug#47464] [PATCH 5/8] scripts: publish: " zimoun
@ 2021-03-29 10:18 ` zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 7/8] scripts: search: " zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 8/8] scripts: show: " zimoun
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/repl.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/repl.scm | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 9f20803efc..50d18c7760 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2020, 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2020 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;;
;;; This file is part of GNU Guix.
@@ -143,14 +143,13 @@ call THUNK."
(synopsis "read-eval-print loop (REPL) for interactive programming")
(define opts
- (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f
+ #:argument-handler
(lambda (arg result)
(append `((script . ,arg)
(ignore-dot-guile? . #t))
- result))
- %default-options))
+ result))))
(define user-config
(and=> (getenv "HOME")
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#47464] [PATCH 7/8] scripts: search: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
` (4 preceding siblings ...)
2021-03-29 10:18 ` [bug#47464] [PATCH 6/8] scripts: repl: " zimoun
@ 2021-03-29 10:18 ` zimoun
2021-03-29 10:18 ` [bug#47464] [PATCH 8/8] scripts: show: " zimoun
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/search.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/search.scm | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/guix/scripts/search.scm b/guix/scripts/search.scm
index 0c9e6af07b..27b9da5278 100644
--- a/guix/scripts/search.scm
+++ b/guix/scripts/search.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,11 +67,9 @@ This is an alias for 'guix package -s'.\n"))
result))
(define opts
- (args-fold* args %options
- (lambda (opt name arg . rest)
- (leave (G_ "~A: unrecognized option~%") name))
- handle-argument
- '()))
+ (parse-command-line args %options (list (list))
+ #:build-options? #f
+ #:argument-handler handle-argument))
(unless (assoc-ref opts 'query)
(leave (G_ "missing arguments: no regular expressions to search for~%")))
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#47464] [PATCH 8/8] scripts: show: Replace 'args-fold*' by 'parse-command-line'.
2021-03-29 10:17 ` [bug#47464] [PATCH 1/8] scripts: describe: Replace 'args-fold*' by 'parse-command-line' zimoun
` (5 preceding siblings ...)
2021-03-29 10:18 ` [bug#47464] [PATCH 7/8] scripts: search: " zimoun
@ 2021-03-29 10:18 ` zimoun
6 siblings, 0 replies; 10+ messages in thread
From: zimoun @ 2021-03-29 10:18 UTC (permalink / raw)
To: 47464; +Cc: zimoun
* guix/scripts/show.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.
---
guix/scripts/show.scm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/guix/scripts/show.scm b/guix/scripts/show.scm
index 535d03c1a6..c747eedd21 100644
--- a/guix/scripts/show.scm
+++ b/guix/scripts/show.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2019, 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,11 +66,9 @@ This is an alias for 'guix package --show='.\n"))
result))
(define opts
- (args-fold* args %options
- (lambda (opt name arg . rest)
- (leave (G_ "~A: unrecognized option~%") name))
- handle-argument
- '()))
+ (parse-command-line args %options (list (list))
+ #:build-options? #f
+ #:argument-handler handle-argument))
(unless (assoc-ref opts 'query)
(leave (G_ "missing arguments: no package to show~%")))
--
2.30.1
^ permalink raw reply related [flat|nested] 10+ messages in thread