diff mbox series

[bug#59754,1/2] scripts: repl: Add --list-types flag.

Message ID 20221203010937.2332-1-antero@mailbox.org
State New
Headers show
Series [bug#59754,1/2] scripts: repl: Add --list-types flag. | expand

Commit Message

Antero Mejr Dec. 3, 2022, 1:09 a.m. UTC
* guix/scripts/repl.scm (%options): Add --list-types.
* doc/guix.texi (Invoking guix repl): Add documentation for --list-types.
---
 doc/guix.texi         | 4 ++++
 guix/scripts/repl.scm | 6 ++++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 47b805dc7f..cf9e6f640d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12011,6 +12011,10 @@  of Guix.
 The available options are as follows:
 
 @table @code
+@item --list-types
+Display the @var{TYPE} options for @command{guix repl --type=TYPE} and
+exit.
+
 @item --type=@var{type}
 @itemx -t @var{type}
 Start a REPL of the given @var{TYPE}, which can be one of the following:
diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 50d18c7760..0ec62786e9 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -52,6 +52,10 @@  (define %options
         (option '(#\t "type") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'type (string->symbol arg) result)))
+        (option '("list-types") #f #f
+                (lambda (opt name arg result)
+                  (display (string-join '("guile" "machine") "\n" 'suffix))
+                  (exit 0)))
         (option '("listen") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'listen arg result)))
@@ -70,6 +74,8 @@  (define (show-help)
   (display (G_ "Usage: guix repl [OPTIONS...] [-- FILE ARGS...]
 In the Guix execution environment, run FILE as a Guile script with
 command-line arguments ARGS.  If no FILE is given, start a Guile REPL.\n"))
+  (display (G_ "
+      --list-types       display REPL types and exit"))
   (display (G_ "
   -t, --type=TYPE        start a REPL of the given TYPE"))
   (display (G_ "