unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#59754] [PATCH] scripts: repl: Add --interactive and --list-types flags.
@ 2022-12-02  2:56 Antero Mejr via Guix-patches via
  2022-12-02  3:35 ` [bug#59754] [PATCH] doc: Add new flag information to REPL section Antero Mejr via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-12-02  2:56 UTC (permalink / raw)
  To: 59754; +Cc: Antero Mejr, ludo

* guix/scripts/repl.scm (guix-repl): Honor -i, --interactive flag.
(%options): Add -i/--interactive and --l/--list-types.
---
 guix/scripts/repl.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 50d18c7760..eac3d7264e 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -52,12 +52,19 @@ (define %options
         (option '(#\t "type") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'type (string->symbol arg) result)))
+        (option '(#\l "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)))
         (option '(#\q) #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'ignore-dot-guile? #t result)))
+        (option '(#\i "interactive") #f #f
+                (lambda (opt name arg result)
+                  (alist-cons 'interactive? #t result)))
         (option '(#\L "load-path") #t #f
                 (lambda (opt name arg result)
                   ;; XXX: Imperatively modify the search paths.
@@ -78,9 +85,15 @@ (define (show-help)
   -q                     inhibit loading of ~/.guile"))
   (newline)
   (display (G_ "
+  -i, --interactive      launch REPL after evaluating FILE"))
+  (newline)
+  (display (G_ "
   -L, --load-path=DIR    prepend DIR to the package module search path"))
   (newline)
   (display (G_ "
+  -l, --list-types       display REPL types and exit"))
+  (newline)
+  (display (G_ "
   -h, --help             display this help and exit"))
   (display (G_ "
   -V, --version          display version information and exit"))
@@ -190,7 +203,7 @@ (define script
          ;; file in %LOAD-PATH.  Thus, pass (getcwd) instead of ".".
          (load-in-vicinity (getcwd) (car script)))))
 
-    (when (null? script)
+    (when (or (null? script) (assoc-ref opts 'interactive?))
       ;; Start REPL
       (let ((type (assoc-ref opts 'type)))
         (call-with-connection (assoc-ref opts 'listen)
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-16 14:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02  2:56 [bug#59754] [PATCH] scripts: repl: Add --interactive and --list-types flags Antero Mejr via Guix-patches via
2022-12-02  3:35 ` [bug#59754] [PATCH] doc: Add new flag information to REPL section Antero Mejr via Guix-patches via
2022-12-02 15:46 ` [bug#59754] [PATCH] scripts: repl: Add --interactive and --list-types flags zimoun
2022-12-03  1:10   ` Antero Mejr via Guix-patches via
2022-12-03  1:09 ` [bug#59754] [PATCH 1/2] scripts: repl: Add --list-types flag Antero Mejr via Guix-patches via
2022-12-03  1:09   ` [bug#59754] [PATCH 2/2] scripts: repl: Add -i, --interactive flag Antero Mejr via Guix-patches via
2023-01-16 14:03     ` bug#59754: [PATCH] scripts: repl: Add --interactive and --list-types flags Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).