repl: Add '--load-path' option.
authorzimoun <zimon.toutoune@gmail.com>
Wed, 15 Jan 2020 17:00:05 +0000 (18:00 +0100)
committerPierre Neidhardt <mail@ambrevar.xyz>
Thu, 16 Jan 2020 14:27:24 +0000 (15:27 +0100)
* guix/scripts/repl.scm (%option): Add '--load-path' option.
* doc/guix.texi: Document it.

doc/guix.texi
guix/scripts/repl.scm

index 87ad121..788a2a7 100644 (file)
@@ -7996,6 +7996,14 @@ Accept connections on localhost on port 37146.
 @item --listen=unix:/tmp/socket
 Accept connections on the Unix-domain socket @file{/tmp/socket}.
 @end table
+
+@item --load-path=@var{directory}
+@itemx -L @var{directory}
+Add @var{directory} to the front of the package module search path
+(@pxref{Package Modules}).
+
+This allows users to define their own packages and make them visible to
+the command-line tool.
 @end table
 
 @c *********************************************************************
index e1cc759..39a9b09 100644 (file)
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +20,7 @@
 (define-module (guix scripts repl)
   #:use-module (guix ui)
   #:use-module (guix scripts)
+  #:use-module ((guix scripts build) #:select (%standard-build-options))
   #:use-module (guix repl)
   #:use-module (guix utils)
   #:use-module (guix packages)
                   (alist-cons 'type (string->symbol arg) result)))
         (option '("listen") #t #f
                 (lambda (opt name arg result)
-                  (alist-cons 'listen arg result)))))
+                  (alist-cons 'listen arg result)))
+        (find (lambda (option)
+                (member "load-path" (option-names option)))
+              %standard-build-options)))
 
 
 (define (show-help)
@@ -60,6 +65,8 @@
 Start a Guile REPL in the Guix execution environment.\n"))
   (display (G_ "
   -t, --type=TYPE        start a REPL of the given TYPE"))
+  (display (G_ "
+  -L, --load-path=DIR    prepend DIR to the package module search path"))
   (newline)
   (display (G_ "
   -h, --help             display this help and exit"))