summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorAntero Mejr <antero@mailbox.org>2022-12-03 01:09:37 +0000
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-01-16 09:00:03 -0500
commit93e683a9527563bd5bc815d1a2c90cdf28957080 (patch)
tree80255235097e760a8bbd0f0ed59606dbc12ac89d /guix/scripts
parentabd956957138d4c5339e9cb79dd590fc19808438 (diff)
scripts: repl: Add -i, --interactive flag.
* guix/scripts/repl.scm (%options): Add -i, --interactive flag. (guix-repl): Honor -i, --interactive flag. * doc/guix.texi (Invoking guix repl): Add documentation for -i, --interactive. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/repl.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 0ec62786e9..787c63d48e 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -62,6 +62,9 @@
(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.
@@ -84,6 +87,9 @@ command-line arguments ARGS. If no FILE is given, start a Guile REPL.\n"))
-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_ "
@@ -196,7 +202,7 @@ call THUNK."
;; 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)