mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
repl: Add "-q".
* guix/scripts/repl.scm (%options, show-help): Add "-q". (guix-repl): Add 'user-config' and use it. Honor 'ignore-dot-guile?'.
This commit is contained in:
parent
3adf320e44
commit
a9f4a7eee3
2 changed files with 20 additions and 6 deletions
|
@ -8008,6 +8008,10 @@ Add @var{directory} to the front of the package module search path
|
||||||
|
|
||||||
This allows users to define their own packages and make them visible to
|
This allows users to define their own packages and make them visible to
|
||||||
the command-line tool.
|
the command-line tool.
|
||||||
|
|
||||||
|
@item -q
|
||||||
|
Inhibit loading of the @file{~/.guile} file. By default, that
|
||||||
|
configuration file is loaded when spawning a @code{guile} REPL.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@c *********************************************************************
|
@c *********************************************************************
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; 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>
|
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -55,6 +55,9 @@
|
||||||
(option '("listen") #t #f
|
(option '("listen") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'listen 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)
|
(find (lambda (option)
|
||||||
(member "load-path" (option-names option)))
|
(member "load-path" (option-names option)))
|
||||||
%standard-build-options)))
|
%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"))
|
-t, --type=TYPE start a REPL of the given TYPE"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--listen=ENDPOINT listen ENDPOINT instead of standard I/O"))
|
--listen=ENDPOINT listen ENDPOINT instead of standard I/O"))
|
||||||
|
(display (G_ "
|
||||||
|
-q inhibit loading of ~/.guile"))
|
||||||
(newline)
|
(newline)
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
-L, --load-path=DIR prepend DIR to the package module search path"))
|
-L, --load-path=DIR prepend DIR to the package module search path"))
|
||||||
|
@ -139,6 +144,11 @@ call THUNK."
|
||||||
(leave (G_ "~A: extraneous argument~%") arg))
|
(leave (G_ "~A: extraneous argument~%") arg))
|
||||||
%default-options))
|
%default-options))
|
||||||
|
|
||||||
|
(define user-config
|
||||||
|
(and=> (getenv "HOME")
|
||||||
|
(lambda (home)
|
||||||
|
(string-append home "/.guile"))))
|
||||||
|
|
||||||
(with-error-handling
|
(with-error-handling
|
||||||
(let ((type (assoc-ref opts 'type)))
|
(let ((type (assoc-ref opts 'type)))
|
||||||
(call-with-connection (assoc-ref opts 'listen)
|
(call-with-connection (assoc-ref opts 'listen)
|
||||||
|
@ -148,11 +158,11 @@ call THUNK."
|
||||||
(save-module-excursion
|
(save-module-excursion
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(set-current-module user-module)
|
(set-current-module user-module)
|
||||||
(and=> (getenv "HOME")
|
(when (and (not (assoc-ref opts 'ignore-dot-guile?))
|
||||||
(lambda (home)
|
user-config
|
||||||
(let ((guile (string-append home "/.guile")))
|
(file-exists? user-config))
|
||||||
(when (file-exists? guile)
|
(load user-config))
|
||||||
(load guile)))))
|
|
||||||
;; Do not exit repl on SIGINT.
|
;; Do not exit repl on SIGINT.
|
||||||
((@@ (ice-9 top-repl) call-with-sigint)
|
((@@ (ice-9 top-repl) call-with-sigint)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue