This is an automated email from the git hooks/post-receive script.

lilyp pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 9013a53705 import/elpa: Improve CLI documentation for archive flag.
9013a53705 is described below

commit 9013a5370582807b0b71a8a0a0d7f63f2ca614b3
Author: Liliana Marie Prikler <[email protected]>
AuthorDate: Mon Apr 21 08:13:03 2025 +0200

    import/elpa: Improve CLI documentation for archive flag.
    
    * guix/import/elpa.scm (elpa-url)[elpa-archives]: Move from here…
    (%elpa-archives): … to here.
    * guix/scripts/import/elpa.scm (%options): Add “list-archives”.
    (show-help): Adjust accordingly.
    
    Change-Id: Ib686bd9ff5eff2d4c37b8751ec1410666d568c1f
    Co-authored-by: jgart <[email protected]>
    Signed-off-by: Liliana Marie Prikler <[email protected]>
---
 guix/import/elpa.scm         | 17 ++++++++++-------
 guix/scripts/import/elpa.scm | 15 +++++++++++++++
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index ea16885d90..eda3d6d60b 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <[email protected]>
 ;;; Copyright © 2021 Simon Tournier <[email protected]>
 ;;; Copyright © 2022 Hartmut Goebel <[email protected]>
+;;; Copyright © 2025 jgart <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -51,6 +52,7 @@
   #:use-module (guix memoization)
   #:export (elpa->guix-package
             guix-package->elpa-name
+            %elpa-archives
             %elpa-updater
             elpa-recursive-import))
 
@@ -81,15 +83,16 @@ NAMES (strings)."
         (string-downcase name)
         (string-append package-name-prefix (string-downcase name)))))
 
+(define %elpa-archives
+  '((gnu . "https://elpa.gnu.org/packages";)
+    (gnu/http . "http://elpa.gnu.org/packages";) ;for testing
+    (nongnu . "https://elpa.nongnu.org/nongnu";)
+    (melpa-stable . "https://stable.melpa.org/packages";)
+    (melpa . "https://melpa.org/packages";)))
+
 (define* (elpa-url #:optional (repo 'gnu))
   "Retrieve the URL of REPO."
-  (let ((elpa-archives
-         '((gnu . "https://elpa.gnu.org/packages";)
-           (gnu/http . "http://elpa.gnu.org/packages";) ;for testing
-           (nongnu . "https://elpa.nongnu.org/nongnu";)
-           (melpa-stable . "https://stable.melpa.org/packages";)
-           (melpa . "https://melpa.org/packages";))))
-    (assq-ref elpa-archives repo)))
+  (assq-ref %elpa-archives repo))
 
 (define* (elpa-fetch-archive #:optional (repo 'gnu))
   "Retrieve the archive with the list of packages available from REPO."
diff --git a/guix/scripts/import/elpa.scm b/guix/scripts/import/elpa.scm
index 7f77beaac0..72add39f73 100644
--- a/guix/scripts/import/elpa.scm
+++ b/guix/scripts/import/elpa.scm
@@ -4,6 +4,8 @@
 ;;; Copyright © 2020 Martin Becze <[email protected]>
 ;;; Copyright © 2021 Sarah Morgensen <[email protected]>
 ;;; Copyright © 2023 Simon Tournier <[email protected]>
+;;; Copyright © 2025 jgart <[email protected]>
+;;; Copyright © 2025 Liliana Marie Prikler <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -48,6 +50,8 @@ Import the latest package named PACKAGE-NAME from an ELPA 
repository.\n"))
   (display (G_ "
   -a, --archive=ARCHIVE          specify the archive repository"))
   (display (G_ "
+  -l, --list-archives            list ELPA repositories supported by the 
importer"))
+  (display (G_ "
   -h, --help                     display this help and exit"))
   (display (G_ "
   -r, --recursive                generate package expressions for all Emacs 
packages that are not yet in Guix"))
@@ -69,6 +73,17 @@ Import the latest package named PACKAGE-NAME from an ELPA 
repository.\n"))
                  (lambda (opt name arg result)
                    (alist-cons 'repo (string->symbol arg)
                                (alist-delete 'repo result))))
+         (option '(#\l "list-archives") #f #f
+                 (lambda (opt name arg result)
+                   (display (G_ "The following archives are supported:\n"))
+                   (for-each (match-lambda
+                               ((sym . repo)
+                                (format #t "  ~a: ~a\n" sym repo)))
+                             %elpa-archives)
+                   (display
+                    (G_ "The argument to --archive should be one of these \
+symbols, e.g. gnu (the default).\n"))
+                   (exit 0)))
          (option '(#\r "recursive") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'recursive #t result)))

Reply via email to