summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-19 21:54:46 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-19 23:11:37 +0100
commita9f4a7eee379accded2bd1515d8acb0746ea0517 (patch)
tree2a19367a00b41a78a295f2d33379efe9811ddfc0 /guix
parent3adf320e44e54017a67f219ce9667a379c393dad (diff)
repl: Add "-q".
* guix/scripts/repl.scm (%options, show-help): Add "-q". (guix-repl): Add 'user-config' and use it. Honor 'ignore-dot-guile?'.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/repl.scm22
1 files changed, 16 insertions, 6 deletions
diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index fc3e4e2131..721c0a7450 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
@@ -55,6 +55,9 @@
(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)))
(find (lambda (option)
(member "load-path" (option-names option)))
%standard-build-options)))
@@ -67,6 +70,8 @@ Start a Guile REPL in the Guix execution environment.\n"))
-t, --type=TYPE start a REPL of the given TYPE"))
(display (G_ "
--listen=ENDPOINT listen ENDPOINT instead of standard I/O"))
+ (display (G_ "
+ -q inhibit loading of ~/.guile"))
(newline)
(display (G_ "
-L, --load-path=DIR prepend DIR to the package module search path"))
@@ -139,6 +144,11 @@ call THUNK."
(leave (G_ "~A: extraneous argument~%") arg))
%default-options))
+ (define user-config
+ (and=> (getenv "HOME")
+ (lambda (home)
+ (string-append home "/.guile"))))
+
(with-error-handling
(let ((type (assoc-ref opts 'type)))
(call-with-connection (assoc-ref opts 'listen)
@@ -148,11 +158,11 @@ call THUNK."
(save-module-excursion
(lambda ()
(set-current-module user-module)
- (and=> (getenv "HOME")
- (lambda (home)
- (let ((guile (string-append home "/.guile")))
- (when (file-exists? guile)
- (load guile)))))
+ (when (and (not (assoc-ref opts 'ignore-dot-guile?))
+ user-config
+ (file-exists? user-config))
+ (load user-config))
+
;; Do not exit repl on SIGINT.
((@@ (ice-9 top-repl) call-with-sigint)
(lambda ()