[PATCH 00/14] import: Use PARSE-COMMAND-LINE for options.

  • Done
  • quality assurance status badge
Details
3 participants
  • Sarah Morgensen
  • Ludovic Courtès
  • zimoun
Owner
unassigned
Submitted by
Sarah Morgensen
Severity
normal
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:51
(address . guix-patches@gnu.org)
cover.1627617006.git.iskarian@mgsn.dev
Hello Guix,

I noticed that we have an ARGS-FOLD* wrapper called PARSE-COMMAND-LINE which has
the same invalid argument message as the importers, the same argument handler,
and has an option hint feature. So let's use that in the importers.

The change is identical across all importers, and the semantics as far as return
value are identical, so this should just be a drop-in.

--
Sarah Morgensen (14):
import: go: Use PARSE-COMMAND-LINE for options.
import: egg: Use PARSE-COMMAND-LINE for options.
import: gem: Use PARSE-COMMAND-LINE for options.
import: gnu: Use PARSE-COMMAND-LINE for options.
import: cpan: Use PARSE-COMMAND-LINE for options.
import: cran: Use PARSE-COMMAND-LINE for options.
import: elpa: Use PARSE-COMMAND-LINE for options.
import: json: Use PARSE-COMMAND-LINE for options.
import: opam: Use PARSE-COMMAND-LINE for options.
import: pypi: Use PARSE-COMMAND-LINE for options.
import: crate: Use PARSE-COMMAND-LINE for options.
import: texlive: Use PARSE-COMMAND-LINE for options.
import: hackage: Use PARSE-COMMAND-LINE for options.
import: stackage: Use PARSE-COMMAND-LINE for options.

guix/scripts/import/cpan.scm | 9 +++------
guix/scripts/import/cran.scm | 9 +++------
guix/scripts/import/crate.scm | 10 +++-------
guix/scripts/import/egg.scm | 9 +++------
guix/scripts/import/elpa.scm | 9 +++------
guix/scripts/import/gem.scm | 9 +++------
guix/scripts/import/gnu.scm | 9 +++------
guix/scripts/import/go.scm | 9 +++------
guix/scripts/import/hackage.scm | 9 +++------
guix/scripts/import/json.scm | 9 +++------
guix/scripts/import/opam.scm | 9 +++------
guix/scripts/import/pypi.scm | 9 +++------
guix/scripts/import/stackage.scm | 9 +++------
guix/scripts/import/texlive.scm | 9 +++------
14 files changed, 42 insertions(+), 85 deletions(-)


base-commit: daeef2e7f4f36df7a098c9aee7c03546d8691d39
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:54
[PATCH 01/14] import: go: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
a7c5e792d4f99c799cb3f8c665fd3e10e0579a37.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/go.scm (guix-import-go)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/go.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
index 74e8e60cce..e08a1e427e 100644
--- a/guix/scripts/import/go.scm
+++ b/guix/scripts/import/go.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -83,12 +84,8 @@ that are not yet in Guix"))
(define (guix-import-go . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:54
[PATCH 02/14] import: egg: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
5a19dcc9709dcacc09e08bfc7db6fb2c872ba596.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/egg.scm (guix-import-egg)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/egg.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm
index 7dbd6fcd5a..829cdc2ca0 100644
--- a/guix/scripts/import/egg.scm
+++ b/guix/scripts/import/egg.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -71,12 +72,8 @@ Import and convert the egg package for PACKAGE-NAME.\n"))
(define (guix-import-egg . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(repo (and=> (assoc-ref opts 'repo) string->symbol))
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:54
[PATCH 03/14] import: gem: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
88cd802f44b842faf7a87329b01a7860ff38e1e7.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/gem.scm (guix-import-gem)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/gem.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/gem.scm b/guix/scripts/import/gem.scm
index c64596b514..65d2bf10b4 100644
--- a/guix/scripts/import/gem.scm
+++ b/guix/scripts/import/gem.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -73,12 +74,8 @@ Import and convert the RubyGems package for PACKAGE-NAME.\n"))
(define (guix-import-gem . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 04/14] import: gnu: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
cfdd3813c1f70ad9f999f5970427644ea591294e.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/gnu.scm (guix-import-gnu)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/gnu.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/scripts/import/gnu.scm b/guix/scripts/import/gnu.scm
index ae98370037..344e363abe 100644
--- a/guix/scripts/import/gnu.scm
+++ b/guix/scripts/import/gnu.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -81,12 +82,8 @@ Return a package declaration template for PACKAGE, a GNU package.\n"))
(define (guix-import-gnu . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 05/14] import: cpan: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
94492cb4dec436cfa3968af23db192a6e199ccea.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/cpan.scm (guix-import-cpan)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/cpan.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/scripts/import/cpan.scm b/guix/scripts/import/cpan.scm
index 77ffe1f38e..bdf5a1e423 100644
--- a/guix/scripts/import/cpan.scm
+++ b/guix/scripts/import/cpan.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,12 +67,8 @@ Import and convert the CPAN package for PACKAGE-NAME.\n"))
(define (guix-import-cpan . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 06/14] import: cran: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
4600ae9cdab23bc81790a9a2098d813ea2941205.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/cran.scm (guix-import-cran)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/cran.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm
index aa3ef324e0..3e4b038cc4 100644
--- a/guix/scripts/import/cran.scm
+++ b/guix/scripts/import/cran.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015, 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -86,12 +87,8 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
(define (guix-import-cran . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 07/14] import: elpa: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
8fdf9feebd6ec374c15d0b80948fd985f1c2312a.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/elpa.scm (guix-import-elpa)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/elpa.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/elpa.scm b/guix/scripts/import/elpa.scm
index d6b38e5c4b..052b0cc0e7 100644
--- a/guix/scripts/import/elpa.scm
+++ b/guix/scripts/import/elpa.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -80,12 +81,8 @@ Import the latest package named PACKAGE-NAME from an ELPA repository.\n"))
(define (guix-import-elpa . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 08/14] import: json: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
0136e6efdb033fc2bdf8bd0c4a0a9d64eb742115.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/json.scm (guix-import-json)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/json.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/json.scm b/guix/scripts/import/json.scm
index d8d5c3a4af..a3b5e6d79c 100644
--- a/guix/scripts/import/json.scm
+++ b/guix/scripts/import/json.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -74,12 +75,8 @@ Import and convert the JSON package definition in PACKAGE-FILE.\n"))
(define (guix-import-json . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 09/14] import: opam: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
2f03c9d080eeec52abbe43db2c1c02099086c2b2.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/opam.scm (guix-import-opam)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/opam.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/scripts/import/opam.scm b/guix/scripts/import/opam.scm
index da9392821c..64164e7cc4 100644
--- a/guix/scripts/import/opam.scm
+++ b/guix/scripts/import/opam.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -76,12 +77,8 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
(define (guix-import-opam . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(repo (and=> (assoc-ref opts 'repo) string->symbol))
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 10/14] import: pypi: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
525c47b49dbab918c23b07d1c197496b028930c9.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/pypi.scm (guix-import-pypi)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/pypi.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/pypi.scm b/guix/scripts/import/pypi.scm
index 33167174e2..9170a0b359 100644
--- a/guix/scripts/import/pypi.scm
+++ b/guix/scripts/import/pypi.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -72,12 +73,8 @@ Import and convert the PyPI package for PACKAGE-NAME.\n"))
(define (guix-import-pypi . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 11/14] import: crate: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
85674bf52bdbac917e5f68ca47c226ec5b2c3371.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/crate.scm (guix-import-crate)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/crate.scm | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

Toggle diff (30 lines)
diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm
index 3a96defb86..97152904ac 100644
--- a/guix/scripts/import/crate.scm
+++ b/guix/scripts/import/crate.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -75,13 +76,8 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(define (guix-import-crate . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
-
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 12/14] import: texlive: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
13032b76fab4f6580e657cd4cda1f24b69b5ad9f.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/texlive.scm (guix-import-texlive)[parse-options]:
Use PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/texlive.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/scripts/import/texlive.scm b/guix/scripts/import/texlive.scm
index 1cceee7051..6f0818e274 100644
--- a/guix/scripts/import/texlive.scm
+++ b/guix/scripts/import/texlive.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -73,12 +74,8 @@ Import and convert the Texlive package for PACKAGE-NAME.\n"))
(define (guix-import-texlive . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 13/14] import: hackage: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
30e8e284d65f381e30e9bc84c47744b12b2abf9d.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/hackage.scm (guix-import-hackage)[parse-options]:
Use PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/hackage.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/hackage.scm b/guix/scripts/import/hackage.scm
index 906dca24b1..83128fb816 100644
--- a/guix/scripts/import/hackage.scm
+++ b/guix/scripts/import/hackage.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -105,12 +106,8 @@ version.\n"))
(define (guix-import-hackage . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (run-importer package-name opts error-fn)
(let* ((arguments (list
--
2.31.1
S
S
Sarah Morgensen wrote on 30 Jul 2021 05:55
[PATCH 14/14] import: stackage: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
8dcfa87ce142e999afef7896c4d1bb58746e50a6.1627617006.git.iskarian@mgsn.dev
guix/scripts/import/stackage.scm (guix-import-stackage)[parse-options]:
Use PARSE-COMMAND-LINE instead of ARGS-FOLD*.
---
guix/scripts/import/stackage.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/scripts/import/stackage.scm b/guix/scripts/import/stackage.scm
index d77328dcbf..211ac73ada 100644
--- a/guix/scripts/import/stackage.scm
+++ b/guix/scripts/import/stackage.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -89,12 +90,8 @@ Import and convert the LTS Stackage package for PACKAGE-NAME.\n"))
(define (guix-import-stackage . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (run-importer package-name opts error-fn)
(let* ((arguments (list
--
2.31.1
L
L
Ludovic Courtès wrote on 3 Aug 2021 17:47
Re: bug#49780: [PATCH 00/14] import: Use PARSE-COMMAND-LINE for options.
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 49780@debbugs.gnu.org)
87czquttrx.fsf@gnu.org
Hi Sarah,

Sarah Morgensen <iskarian@mgsn.dev> skribis:

Toggle quote (7 lines)
> I noticed that we have an ARGS-FOLD* wrapper called PARSE-COMMAND-LINE which has
> the same invalid argument message as the importers, the same argument handler,
> and has an option hint feature. So let's use that in the importers.
>
> The change is identical across all importers, and the semantics as far as return
> value are identical, so this should just be a drop-in.

Neat, that’s a welcome change. I hope you won’t hate me for suggesting
this, but I think such systematic API evolution changes can go in a
single commit. WDYT?

Nitpick:

guix/scripts/import/go.scm (guix-import-go)[parse-options]: Use
^
You need a ‘*’ at the beginning of the line.

Thanks!

Ludo’.
S
S
Sarah Morgensen wrote on 3 Aug 2021 20:24
[PATCH v2] import: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
727dc025443a70a985c0e8006e25c468f7524037.1628014596.git.iskarian@mgsn.dev
* guix/scripts/import/go.scm (guix-import-go)[parse-options]: Use
PARSE-COMMAND-LINE instead of ARGS-FOLD*.
* guix/scripts/import/egg.scm (guix-import-egg)[parse-options]:
Likewise.
* guix/scripts/import/gem.scm (guix-import-gem)[parse-options]:
Likewise.
* guix/scripts/import/gnu.scm (guix-import-gnu)[parse-options]:
Likewise.
* guix/scripts/import/cpan.scm (guix-import-cpan)[parse-options]:
Likewise.
* guix/scripts/import/cran.scm (guix-import-cran)[parse-options]:
Likewise.
* guix/scripts/import/elpa.scm (guix-import-elpa)[parse-options]:
Likewise.
* guix/scripts/import/json.scm (guix-import-json)[parse-options]:
Likewise.
* guix/scripts/import/opam.scm (guix-import-opam)[parse-options]:
Likewise.
* guix/scripts/import/pypi.scm (guix-import-pypi)[parse-options]:
Likewise.
* guix/scripts/import/crate.scm (guix-import-crate)[parse-options]:
Likewise.
* guix/scripts/import/texlive.scm (guix-import-texlive)[parse-options]:
Likewise.
* guix/scripts/import/hackage.scm (guix-import-hackage)[parse-options]:
Likewise.
* guix/scripts/import/stackage.scm (guix-import-stackage)[parse-options]:
Likewise.
---
guix/scripts/import/cpan.scm | 9 +++------
guix/scripts/import/cran.scm | 9 +++------
guix/scripts/import/crate.scm | 10 +++-------
guix/scripts/import/egg.scm | 9 +++------
guix/scripts/import/elpa.scm | 9 +++------
guix/scripts/import/gem.scm | 9 +++------
guix/scripts/import/gnu.scm | 9 +++------
guix/scripts/import/go.scm | 9 +++------
guix/scripts/import/hackage.scm | 9 +++------
guix/scripts/import/json.scm | 9 +++------
guix/scripts/import/opam.scm | 9 +++------
guix/scripts/import/pypi.scm | 9 +++------
guix/scripts/import/stackage.scm | 9 +++------
guix/scripts/import/texlive.scm | 9 +++------
14 files changed, 42 insertions(+), 85 deletions(-)

Toggle diff (378 lines)
diff --git a/guix/scripts/import/cpan.scm b/guix/scripts/import/cpan.scm
index 77ffe1f38e..bdf5a1e423 100644
--- a/guix/scripts/import/cpan.scm
+++ b/guix/scripts/import/cpan.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,12 +67,8 @@ Import and convert the CPAN package for PACKAGE-NAME.\n"))
(define (guix-import-cpan . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm
index aa3ef324e0..3e4b038cc4 100644
--- a/guix/scripts/import/cran.scm
+++ b/guix/scripts/import/cran.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015, 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -86,12 +87,8 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
(define (guix-import-cran . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm
index 3a96defb86..97152904ac 100644
--- a/guix/scripts/import/crate.scm
+++ b/guix/scripts/import/crate.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -75,13 +76,8 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(define (guix-import-crate . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
-
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm
index 7dbd6fcd5a..829cdc2ca0 100644
--- a/guix/scripts/import/egg.scm
+++ b/guix/scripts/import/egg.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -71,12 +72,8 @@ Import and convert the egg package for PACKAGE-NAME.\n"))
(define (guix-import-egg . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(repo (and=> (assoc-ref opts 'repo) string->symbol))
diff --git a/guix/scripts/import/elpa.scm b/guix/scripts/import/elpa.scm
index d6b38e5c4b..052b0cc0e7 100644
--- a/guix/scripts/import/elpa.scm
+++ b/guix/scripts/import/elpa.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -80,12 +81,8 @@ Import the latest package named PACKAGE-NAME from an ELPA repository.\n"))
(define (guix-import-elpa . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/gem.scm b/guix/scripts/import/gem.scm
index c64596b514..65d2bf10b4 100644
--- a/guix/scripts/import/gem.scm
+++ b/guix/scripts/import/gem.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -73,12 +74,8 @@ Import and convert the RubyGems package for PACKAGE-NAME.\n"))
(define (guix-import-gem . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/gnu.scm b/guix/scripts/import/gnu.scm
index ae98370037..344e363abe 100644
--- a/guix/scripts/import/gnu.scm
+++ b/guix/scripts/import/gnu.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -81,12 +82,8 @@ Return a package declaration template for PACKAGE, a GNU package.\n"))
(define (guix-import-gnu . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
index 74e8e60cce..e08a1e427e 100644
--- a/guix/scripts/import/go.scm
+++ b/guix/scripts/import/go.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -83,12 +84,8 @@ that are not yet in Guix"))
(define (guix-import-go . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/hackage.scm b/guix/scripts/import/hackage.scm
index 906dca24b1..83128fb816 100644
--- a/guix/scripts/import/hackage.scm
+++ b/guix/scripts/import/hackage.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -105,12 +106,8 @@ version.\n"))
(define (guix-import-hackage . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (run-importer package-name opts error-fn)
(let* ((arguments (list
diff --git a/guix/scripts/import/json.scm b/guix/scripts/import/json.scm
index d8d5c3a4af..a3b5e6d79c 100644
--- a/guix/scripts/import/json.scm
+++ b/guix/scripts/import/json.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -74,12 +75,8 @@ Import and convert the JSON package definition in PACKAGE-FILE.\n"))
(define (guix-import-json . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/opam.scm b/guix/scripts/import/opam.scm
index da9392821c..64164e7cc4 100644
--- a/guix/scripts/import/opam.scm
+++ b/guix/scripts/import/opam.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -76,12 +77,8 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
(define (guix-import-opam . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(repo (and=> (assoc-ref opts 'repo) string->symbol))
diff --git a/guix/scripts/import/pypi.scm b/guix/scripts/import/pypi.scm
index 33167174e2..9170a0b359 100644
--- a/guix/scripts/import/pypi.scm
+++ b/guix/scripts/import/pypi.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -72,12 +73,8 @@ Import and convert the PyPI package for PACKAGE-NAME.\n"))
(define (guix-import-pypi . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
diff --git a/guix/scripts/import/stackage.scm b/guix/scripts/import/stackage.scm
index d77328dcbf..211ac73ada 100644
--- a/guix/scripts/import/stackage.scm
+++ b/guix/scripts/import/stackage.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -89,12 +90,8 @@ Import and convert the LTS Stackage package for PACKAGE-NAME.\n"))
(define (guix-import-stackage . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (run-importer package-name opts error-fn)
(let* ((arguments (list
diff --git a/guix/scripts/import/texlive.scm b/guix/scripts/import/texlive.scm
index 1cceee7051..6f0818e274 100644
--- a/guix/scripts/import/texlive.scm
+++ b/guix/scripts/import/texlive.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -73,12 +74,8 @@ Import and convert the Texlive package for PACKAGE-NAME.\n"))
(define (guix-import-texlive . args)
(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)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda

base-commit: e1ddcf75bf9e68a04698733063dd35a3d5b997ee
--
2.31.1
S
S
Sarah Morgensen wrote on 3 Aug 2021 20:54
Re: bug#49780: [PATCH 00/14] import: Use PARSE-COMMAND-LINE for options.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49780@debbugs.gnu.org)
86bl6e4ava.fsf_-_@mgsn.dev
Hi,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (15 lines)
> Hi Sarah,
>
> Sarah Morgensen <iskarian@mgsn.dev> skribis:
>
>> I noticed that we have an ARGS-FOLD* wrapper called PARSE-COMMAND-LINE which has
>> the same invalid argument message as the importers, the same argument handler,
>> and has an option hint feature. So let's use that in the importers.
>>
>> The change is identical across all importers, and the semantics as far as return
>> value are identical, so this should just be a drop-in.
>
> Neat, that’s a welcome change. I hope you won’t hate me for suggesting
> this, but I think such systematic API evolution changes can go in a
> single commit. WDYT?

Ha! No problem. v2 sent.

Toggle quote (7 lines)
>
> Nitpick:
>
> guix/scripts/import/go.scm (guix-import-go)[parse-options]: Use
> ^
> You need a ‘*’ at the beginning of the line.

Of course I missed that. Fixed in v2. If only etc/committer didn't choke
on it because git-diff decided that literal strings are function
definitions... Looking at it now, git 2.32+ has a built-in function regex
for Scheme, so if we add

*.scm diff=scheme

to a .gitattributes file, we should get better diff headers. Quick
testing shows that if we have nested functions, it shows the innermost
one, though. A little modification to the regex can make it show the
topmost one. This is what we want for etc/committer, but is it what we
want elsewhere? I'll send a patch shortly.

Toggle quote (5 lines)
>
> Thanks!
>
> Ludo’.

--
Sarah
L
L
Ludovic Courtès wrote on 4 Aug 2021 17:01
Re: [PATCH v2] import: Use PARSE-COMMAND-LINE for options.
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 49780-done@debbugs.gnu.org)
87lf5hp834.fsf@gnu.org
Hi,

Sarah Morgensen <iskarian@mgsn.dev> skribis:

Toggle quote (29 lines)
> * guix/scripts/import/go.scm (guix-import-go)[parse-options]: Use
> PARSE-COMMAND-LINE instead of ARGS-FOLD*.
> * guix/scripts/import/egg.scm (guix-import-egg)[parse-options]:
> Likewise.
> * guix/scripts/import/gem.scm (guix-import-gem)[parse-options]:
> Likewise.
> * guix/scripts/import/gnu.scm (guix-import-gnu)[parse-options]:
> Likewise.
> * guix/scripts/import/cpan.scm (guix-import-cpan)[parse-options]:
> Likewise.
> * guix/scripts/import/cran.scm (guix-import-cran)[parse-options]:
> Likewise.
> * guix/scripts/import/elpa.scm (guix-import-elpa)[parse-options]:
> Likewise.
> * guix/scripts/import/json.scm (guix-import-json)[parse-options]:
> Likewise.
> * guix/scripts/import/opam.scm (guix-import-opam)[parse-options]:
> Likewise.
> * guix/scripts/import/pypi.scm (guix-import-pypi)[parse-options]:
> Likewise.
> * guix/scripts/import/crate.scm (guix-import-crate)[parse-options]:
> Likewise.
> * guix/scripts/import/texlive.scm (guix-import-texlive)[parse-options]:
> Likewise.
> * guix/scripts/import/hackage.scm (guix-import-hackage)[parse-options]:
> Likewise.
> * guix/scripts/import/stackage.scm (guix-import-stackage)[parse-options]:
> Likewise.

Applied, thank you!

Ludo’.
Closed
Z
Z
zimoun wrote on 31 Aug 2021 10:24
Re: [bug#49780] [PATCH 00/14] import: Use PARSE-COMMAND-LINE for options.
(address . 49780@debbugs.gnu.org)
867dg210pf.fsf@gmail.com
Hi,

Cool! Thanks Sarah for the improvement.

On Tue, 03 Aug 2021 at 17:47, Ludovic Courtès <ludo@gnu.org> wrote:
Toggle quote (13 lines)
> Sarah Morgensen <iskarian@mgsn.dev> skribis:
>
>> I noticed that we have an ARGS-FOLD* wrapper called PARSE-COMMAND-LINE which has
>> the same invalid argument message as the importers, the same argument handler,
>> and has an option hint feature. So let's use that in the importers.
>>
>> The change is identical across all importers, and the semantics as far as return
>> value are identical, so this should just be a drop-in.
>
> Neat, that’s a welcome change. I hope you won’t hate me for suggesting
> this, but I think such systematic API evolution changes can go in a
> single commit. WDYT?

Well, the previous replacement before the introduction of option hint
had been done with several commits. ;-)

Toggle snippet (7 lines)
4056ba3645 scripts: show: Replace 'args-fold*' by 'parse-command-line'.

[...]

946f563d91 scripts: describe: Replace 'args-fold*' by 'parse-command-line'.

Whatever, now it is pushed. :-)

Cheers,
simon

PS: For the interested reader, the story is not complete yet, the
subcommands “guix system” does not enjoy such. ;-)
?